[R] Force evaluation of a symbol when a function is created

R. Michael Weylandt michael.weylandt at gmail.com
Tue Aug 7 05:10:46 CEST 2012


On Mon, Aug 6, 2012 at 9:03 PM, Schoenfeld, David
Alan,Ph.D.,Biostatistics <DSCHOENFELD at partners.org> wrote:
> Thank you both, this was very helpful.  I need to study environments more. Do either of you know a good source?

Disclaimer: I really have no idea what I'm talking about.

They are a somewhat subtle, but exceptionally powerful concept: see,
inter alia,

cran.r-project.org/doc/contrib/Fox-Companion/appendix-scope.pdf
http://www.lemnica.com/esotericR/Introducing-Closures/

If you know a little bit of C, it will go a long way in understanding
environments in R. You'll want to (eventually) start to associate R
names with C pointers and environments with symbol tables (hence the
fact the printed environment is just a memory address) , but that's
perhaps a little bit down the road. Environments are different in
their fundamental behavior because of this though: they're the best
way to get pass by reference in R.

Best,
Michael



More information about the R-help mailing list