[R] substitute question

Gabor Grothendieck ggrothendieck at myway.com
Thu Mar 18 02:10:43 CET 2004





Consider the following example:

# substitute a with b in the indicated function. Seems to work.
> z <- substitute( function()a+1, list(a=quote(b)) )
> z
function() b + 1

# z is an object of class call so use eval
# to turn it into an object of class expression; however,
# when z is evaluated, the variable  a  returns.  
> eval(z)
function()a+1

Why did  a  suddenly reappear again after it had already been replaced?




More information about the R-help mailing list