[R] nesting environments

Gabor Grothendieck ggrothendieck at gmail.com
Fri Aug 22 15:03:41 CEST 2008


Look at the example section of ?new.env

Also the proto package on CRAN defines proto objects (which are just
environments with
slightly different semantics) and in the Applications section of the home page
has links to examples of using proto objects to creates GUIs with gWidgets:
http://r-proto.googlecode.com

On Fri, Aug 22, 2008 at 8:54 AM, Antje <niederlein-rstat at yahoo.de> wrote:
> Hello,
>
> I got the hint to use nesting environments (for a GUI problem), but I'm not
> sure whether I understand what he means (and I did not really succeed with
> reading documentation - probably I looked for the wrong keywords?).
> That's what he wrote:
>
>> Another good way to control the scoping is nesting environments (e.g.
>> through closures). That is, your object does not need to be global (in the
>> workspace) but it can be in a parent environment. In fact, global variables
>> won't even work when you put your code into a namespaced pacakge, because
>> the namespace will be locked.
>
> Can anybody explain it (probably with a simple example)
> That would be great!
>
> Thanks,
> Antje
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list