quick question.  how do I search up the calling environments until I find a
variable?

> x=function() { m=22; y() }
> y=function() { z() }
> z=function() { mget("m", inherits=TRUE, ifnotfound="m not found") }
> x()
$m
[1] "m not found"

from the perspective of z(), function x is not an enclosing environment.
 do I write a while loop to look back, or is there a standard R function
that searches all calling environments until it finds one that works?

regards,

/iaw
----
Ivo Welch (ivo.we...@gmail.com)

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to