[R] Accessing just the value of an object but not the attributes

Johann Petrak johann at ai.univie.ac.at
Tue Oct 2 17:32:25 CEST 2001


I see the role of as.vector().
But even if as.vector() needs to keep its attribute-dropping
side-effect for compatibility reasons, wouldn't
a dropattr() still be a good idea?
For instance, I can assign attributes to closures, but
wont get rid of them using as.vector() - and neither
using as.function() by the way ...
So if I dont know in advance what kind of object it is
and I do want to just access the "value" in any case
I have to check the type ... ?


Johann

Martin Maechler wrote:

> [...]
> 
> "unfortunately" : 
> 		IMO, a vector with attributes is still a vector, particularly
> 		if these are just names.. hence as.vector() should leave it
> 		alone, but -- alas -- it's for compatibility reasons too
> 		important to be changed. 
> So even if a new  dropattributes() function would do what as.vector() does
> now, it would break too much code if as.vector() was changed...
> Note that "unfortunately" is my personal opinion, not a general R core one.
> 


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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