[R] Question on closure (lexical scoping) and encapsulation

Duncan Murdoch murdoch at stats.uwo.ca
Wed Jun 14 21:16:52 CEST 2000


Coming back to this example:

>> .GlobalEnv
>[1] "$.environment"     "$.foo"             "print.environment"
>[4] "print.foo"         "x"                
>> class(.GlobalEnv)
>[1] "foo"
>> .GlobalEnv$"$.foo"
>function(x,name)get(name,envir=x)

I can't get this to work in 1.0.1.  My "$.foo" method is never being
called, I just get NULL as the result every time.  I can do it using
"[.foo" and .GlobalEnv["$.foo"], but the dollar sign version just
doesn't work.  Any hints?

Duncan Murdoch
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list