[R] create a function given a string

Don Wingate Don.Wingate at intellichem.com
Thu Dec 14 22:38:30 CET 2000


Hello,

I am trying to dynamically create/define a function inside of another
function (as part of a package.) 

I build a string that looks something like this: "x + y" and what I need to
do is define a function f <- function(x,y) { x+y }.

This function "string" is much more complex than this example and depends on
other variables so there is no way to predict what the function will look
like.
The ultimate goal is to pass this function 'outer' 

I have tried many different approaches and just can't find a way to convert
the string "x + y" to the function body x + y.

Any suggestions would be appreciated.

Thank you, Don Wingate
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list