Re: R-beta: bugs and problems
Thomas Lumley (thomas@biostat.washington.edu)
Tue, 2 Jun 1998 09:49:41 -0700 (PDT)
Date: Tue, 2 Jun 1998 09:49:41 -0700 (PDT)
From: Thomas Lumley <thomas@biostat.washington.edu>
To: Jim Lindsey <jlindsey@luc.ac.be>
Subject: Re: R-beta: bugs and problems
In-Reply-To: <9806020712.AA26573@alpha.luc.ac.be>
On Tue, 2 Jun 1998, Jim Lindsey wrote:
>
> 3. To obtain the codes of a factor variable, one uses as.numeric().
> However, this function destroys the properties of the matrix, turning
> it into a vector.
> Factors are very useful, but they are presently a mess for anything
> except simple applications in lm/glm.
You can use codes() to extract the codes of a factor variable while
keeping the matrix structure
R> matrix(factor(1:10),2,5)->a
R> codes(a)
[,1] [,2] [,3] [,4] [,5]
[1,] 1 3 5 7 9
[2,] 2 4 6 8 10
The other problems need more fixing.
Thomas Lumley
UW Biostatistics
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._