From murdoch at stats.uwo.ca  Mon Jan 23 01:38:33 2006
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Sun, 22 Jan 2006 19:38:33 -0500
Subject: [Rd] 2nd argument to substitute()
Message-ID: <43D42589.7070004@stats.uwo.ca>

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



[Rd] 2nd argument to substitute()
Duncan Murdoch