[Rd] 2nd argument to substitute()

Duncan Murdoch murdoch at stats.uwo.ca
Mon Jan 23 01:38:33 CET 2006


The second argument to the substitute() function gives the frame in 
which to look for substitutions.  However, the documentation doesn't 
appear to match what happens exactly.

Could anyone who makes use of this tell me what they would expect to see 
from these calls?

substitute(expr) evaluated at top level
substitute(expr) evaluated within a function
substitute(expr, NULL)
substitute(expr, .GlobalEnv)

In C code:

substitute(expr, R_NilValue) (as used in bind.c)
substitute(expr, R_GlobalEnv) (not used currently, as far as I can see)

The reason I ask is that I'm trying to clean up the findVarInFrame3 
code, and currently substitute calls it with the environment set to 
NULL.  What is the expectation there?

Duncan Murdoch



More information about the R-devel mailing list