Re: [R] more environment questions

2008-07-29 Thread Gabor Grothendieck
No but look at proto since I suspect the creation of proto objects is basically what you are trying to do through the back door. Home page: http://r-proto.googlecode.com On Tue, Jul 29, 2008 at 12:29 PM, Edna Bell <[EMAIL PROTECTED]> wrote: > Is there a way to set the environment within a functi

Re: [R] more environment questions

2008-07-29 Thread Edna Bell
Is there a way to set the environment within a function,, please? On Tue, Jul 29, 2008 at 11:25 AM, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > e1 <- ... > creates a new environment e1 > > environment(e1) > does nothing > > print(environment(e1)) > print environment e1 > > By the way, if you

Re: [R] more environment questions

2008-07-29 Thread Gabor Grothendieck
e1 <- ... creates a new environment e1 environment(e1) does nothing print(environment(e1)) print environment e1 By the way, if you are doing a lot of manipulations of environments you might want to look at the proto package which reframes the whole thing in terms of object oriented programming.

[R] more environment questions

2008-07-29 Thread Edna Bell
Hi R Gurus: Here is some code that I was experimenting with, please: > f1 <- function(x) { + e1 <- new.env(parent=.GlobalEnv) + environment(e1) + print(environment()) + return(mean(x)) + } > f1(1:15) [1] 8 > My question: why isn't the environment within the function set to e1, please? Thanks,