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. On Tue, Jul 29, 2008 at 12:12 PM, Edna Bell <[EMAIL PROTECTED]> wrote: > 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) > <environment: 0x02525444> > [1] 8 >> > > My question: why isn't the environment within the function set to e1, please? > > Thanks, > Edna Bell > > ______________________________________________ > 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. > ______________________________________________ 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.