Something like this?
foo <- function(x) pi*x
eval(as.symbol("foo"))(1:10)
#[1] 3.141593 6.283185 9.424778 12.566371 15.707963 18.849556 21.991149
#[8] 25.132741 28.274334 31.415927
The return value of eval(.)
can be assigned to an object and it will be a function.
f <- eval(as.symbol("foo"))
f
#function(x) pi*x
f(2)
#[1] 6.283185
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…