Skip to content
Prev 198796 / 398506 Next

How to execute a funcition which name is stored in a string?

On Sun, Nov 1, 2009 at 8:07 PM, Ning Ma <pningma at gmail.com> wrote:
One way to accomplish this by using get() to search for a function
that matches your string. You can assign the return value of get() to
a variable which may be used like the original function object:
a <- 'ls'
foo <- get( a, mode = 'function' )
foo()
[1] "a" ? ? ? ? ?"foo"



-Charlie