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

Ning Ma pningma at gmail.com
Mon Nov 2 05:07:37 CET 2009


Hi, everybody

Is there any way to execute a function, which name is stored in a string.
such as:
a <- "ls()"
foo(a) ## same as ls() itself.

Or, to execute a R command, which is stored in a string
such as:
a <- "m1 <- matrix(1:9,3,3)"
foo(a) ## same as the assignment itself




More information about the R-help mailing list