In a real example I was trying to remove the class from the result of table, just because it was to be used as a building block for other things and a simple integer vector seemed likely to be most efficient. I'm puzzled as to why unclass doesn't work. > zed <- table(1:5) > class(zed) [1] "table" > class(unclass(zed)) [1] "array" > class(unclass(unclass(unclass(zed)))) [1] "array" > class(as.vector(zed)) [1] "integer" > sessionInfo() R Under development (unstable) (2012-11-28 r61176) Platform: i686-pc-linux-gnu (32-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=C [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base
Why can't I "unclass" an array?
2 messages · Terry Therneau, Martin Maechler
Terry Therneau <therneau at mayo.edu>
on Fri, 21 Dec 2012 08:05:21 -0600 writes:
> In a real example I was trying to remove the class from the result of table, just because
> it was to be used as a building block for other things and a simple integer vector seemed
> likely to be most efficient.
> I'm puzzled as to why unclass doesn't work.
well "doesn't work" in this case is really rather an implicit question
and the topic really has nothing to do with R-devel, I'm sorry
Terry.
--> follow up on R-help where this belongs.
Martin