R-alpha: factors ...

Thomas Lumley thomas@biostat.washington.edu
Wed, 21 May 1997 08:01:11 -0700 (PDT)


On Wed, 21 May 1997, Kurt Hornik wrote:

> Perhaps someone can enlighten me here:
> R> x <- factor(LETTERS[1:3])
> [1] "factor"
> 
> S-PLUS has
> > x <- factor(LETTERS[1:3])
> > mode(unclass(x))
> [1] "numeric"

It's a feature. R has a primitive factor type, S-PLUS doesn't and so loses
factorness with unclass(). You can use as.numeric() to coerce to numeric
in either system. 


Thomas Lumley
------------------------------------------------------+------
Biostatistics		: "Never attribute to malice what  :
Uni of Washington	:  can be adequately explained by  :
Box 357232		:  incompetence" - Hanlon's Razor  :
Seattle WA 98195-7232	:				   :
------------------------------------------------------------

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel 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-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-