[R] environment question

Edna Bell edna.bell01 at gmail.com
Tue Jul 29 04:04:14 CEST 2008

Hi R users!

I was looking at some of the example code for the "environment"
function.  Here it is:

e1 <- new.env(parent = baseenv())  # this one has enclosure package:base.
e2 <- new.env(parent = e1)
assign("a", 3, envir=e1)
exists("a", envir=e2)   # this succeeds by inheritance
exists("a", envir=e2, inherits = FALSE)
exists("+", envir=e2)   # this succeeds by inheritance

My question is: how can "a" exist in e2 when the ls(e2) gives
character(0), please?

Edna Bell

More information about the R-help mailing list