Thank you Duncan. Interesting. I find it strange that you can't get a list
of the environments. But I'll deal with it...

Anyway, I'm about to start a new R dev project for my company. I'm thinking
about architecture, organization, and gotchas. I went through much of the
documentation you sent me. Thanks!. I came up with what I think is the best
way to implement environments (which I am using like I would use a class in
a traditional OO language) that can be reused in various programs.

I'm thinking of creating different scripts like this:
#this is saved as script name EnvTest.R
myEnvir = new.env()
var1 = 2 + 2
assign("myx",var1,envir=myEnvir)

Then I will write programs like this that will use the environments and the
objects/functions they contain:
source("EnvTest.r")
prgmVar1 = get("myVar1",pos=myEnvir)
## do stuff with env objects
print(prgmVar1)

Do you think this is the best way to use environments to avoid naming
conflicts, take advantage of separation of data, organize scripting
logically, etc. (the benefits of traditional OO classes)? Eventually, I'll
use this on a Linux machine in the cloud using.:
https://github.com/armstrtw/rzmq
https://github.com/armstrtw/AWS.tools
https://github.com/armstrtw/deathstar
http://code.google.com/p/segue/

...do you (or anyone else) see any gotchas here? Any suggestions, help,
things to watch for are welcome...

Note: I am aware of the (surprising?) scoping rules.

Thanks so much for your help.

Ben

On Tue, Feb 14, 2012 at 5:04 AM, Duncan Murdoch <murdoch.dun...@gmail.com>wrote:

> On 12-02-14 12:34 AM, Ben quant wrote:
>
>> Hello,
>>
>> I can get at environments if I know their names, but what if want to look
>> at what environments currently exist at some point in a script? In other
>> words, if I don't know what environments exist and I don't know their
>> sequence/hierarchy, how do I display a visual representation of the
>> environments and how they relate to one another?
>>
>
> Environments are objects and most of them are maintained in the same
> places as other objects (including some obscure places, such as in
> structures maintained only in external package code), so it's not easy to
> generate a complete list.
>
>
>
>> I'm looking at getting away from the package R.oo and using R in normal
>> state, but I need a way to "check in on" the status and organization of my
>> environments.
>>
>> I've done considerable research on R's environments, but its a challenging
>> thing to google and come up with meaningful results.
>>
>
> I would suggest reading the technical documentation:  the R Language
> manual, the R Internals manual, and some of the papers on the "Technical
> papers" page.
>
> Duncan Murdoch
>

        [[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