R-beta: bugs and problems
Thomas Lumley
thomas at biostat.washington.edu
Tue Jun 2 18:49:41 CEST 1998
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 at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list