Skip to content
Prev 208081 / 398502 Next

evaluating expressions with sub expressions

You asked
   And is there a yet simpler and more
   straightforward way to do the 
   above than what I proposed?

You could use S+, whose substitute() function
   (a) descends into expressions and functions
   (b) has an argument (evaluate=TRUE) so you
       don't need to use do.call when the first
       argument is not a literal
E.g.,
   > e <- expression(a*b, function(x)x+b, log(b))
   > substitute(e, list(b=Quote(exp(1))), evaluate=TRUE)
   expression(a * exp(1), function(x)
   x + exp(1), log(exp(1)))

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com