Dear R-users,
Is there a way to test whether a particular environment e is equal to emtyenv(),
or for that sake whether two environments e1 and e2 are equal?
I tried a couple of ways to compare environments, but neither seem to work:
> e1 <- new.env()
> e2 <- new.env()
> e1 == e2
Error in e1 == e2 :
comparison (1) is possible only for atomic and list
types> all.equal(e1, e2)
[1] TRUE> all.equal(e1, emptyenv())
[1] TRUE
My ultimate goal is to make a list of all variables in the lexical scope
(enclosure?) of a function FUN. So I thought I'd start with environment(FUN)
and apply parent.env() until I reach emptyenv(). But for this to work I need to
be able to detect that I reached emptyenv().
Thank you,
Vadim
> version
_
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 2
minor 9.1
year 2009
month 06
day 26
svn rev 48839
language R
version.string R version 2.9.1 (2009-06-26)
Note: This email is for the confidential use of the named addressee(s) only and
may contain proprietary, confidential or privileged information. If you are not
the intended recipient, you are hereby notified that any review, dissemination
or copying of this email is strictly prohibited, and to please notify the sender
immediately and destroy this email and any attachments. Email transmission
cannot be guaranteed to be secure or error-free. Jump Trading, therefore, does
not make any guarantees as to the completeness or accuracy of this email or any
attachments. This email is for informational purposes only and does not
constitute a recommendation, offer, request or solicitation of any kind to buy,
sell, subscribe, redeem or perform any type of transaction of a financial
product.