2nd argument to substitute()

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

2nd argument to substitute()

Duncan Murdoch
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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel