If I do this:
parse(text="foo()")
I get:
expression(foo())
But what I really need is:
foo()
So basically "foo()"
-> foo()
Also, if I try:
as.symbol("foo()")
I get:
`foo()`
I don't want the tick marks
If I do this:
parse(text="foo()")
I get:
expression(foo())
But what I really need is:
foo()
So basically "foo()"
-> foo()
Also, if I try:
as.symbol("foo()")
I get:
`foo()`
I don't want the tick marks
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