On 6/8/07, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > > After a bit more experimentation I figured out that this does what I want: > > > >> h <- function(x, d) eval(substitute(x), d, parent.frame()) > > > > but I don't understand why the substitute() helps, or indeed why it > > has any effect at all... > > Within the evaluation frame of h, x is a promise to evaluate an > expression. substitute(x) extracts the expression. If you just use x, > it gets evaluated in the frame from which h was called, rather than in a > frame created from d.
Thanks, that's helpful. Could you comment on substitute() use in the message I just posted which contains the actual code I'm trying to get to work? In addition to the question asked there, after your explanation I still do not understand why g <- ... xyplot ( ..., groups=g, ... ) should refuse to find g, and the same thing with groups=substitute(g) works (well, gets farther before blowing up). zw ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
