[R] problems with assigning a class to an environment

Jens Oehlschlägel joehl at gmx.de
Mon Jun 24 21:14:36 CEST 2002


I was surprised to find that calling str() on an environment can remove
attributes from it, as in

> a <- new.env()
> class(a) <- "jens"
> class(a)
[1] "jens"
> str(a)
Class 'jens' length 0 <environment>
> class(a)
NULL

then I found in the R-Language-Manual in chapter 2.1.10 Environments the
sentence: 

	"In particular, assigning attributes to an environment can lead to
surprises"

Can please someone familiar with the internals explain what's going on?

Is it save, to assign a class to a list which contains an environment?


Thank you


Jens Oehlschlägel


> version
         _              
platform i386-pc-mingw32
arch     i386           
os       Win32          
system   i386, mingw32  
status                  
major    1              
minor    5.1            
year     2002           
month    06             
day      17             
language R 

-- 



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list