[Rd] Access variable in attached but removed object

Rainer M Krug Rainer at krugs.de
Fri May 9 12:54:06 CEST 2014


How can I access an object in an attached but deleted environment, when
the object also exists in the .GolbalEnv?

I hope the example below makes the question clear:

--8<---------------cut here---------------start------------->8---
tmp <- attach(what=NULL, name="org:variables")
tmp$test = 13
rm(tmp)
test
# > 13
test <- 24
test
# > 24
ls(all=TRUE)
# > character(0)
# 
# how can I access the variable test in the object org:variables in the
# search path?
#
rm(test)
test
# > 13
--8<---------------cut here---------------end--------------->8---

Any suggestions?

Thanks,

Rainer

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer at krugs.de

Skype:      RMkrug

PGP: 0x0F52F982
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 494 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20140509/20def203/attachment.bin>


More information about the R-devel mailing list