[R] environment question

From: Edna Bell <edna.bell01_at_gmail.com>
Date: Mon, 28 Jul 2008 21:04:14 -0500

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

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. Received on Tue 29 Jul 2008 - 02:07:49 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Jul 2008 - 04:32:39 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive