[R] A matrix with mixed character and numerical columns

michael watson (IAH-C) michael.watson at bbsrc.ac.uk
Thu May 31 12:48:11 CEST 2007


Is it possible to have one?

I have a data.frame with two character columns and 6 numerical columns.

I converted to a matrix as I needed to use the col() and row()
functions.
However, if I convert the data.frame to a matrix, using as.matrix, the
numerical columns get converted to characters, and that messes up some
of the calculations.

Do I really have to split it up into two matrices, one character and the
other numerical, just so I can use the col() and row() functions?  Are
there equivalent functions for data.frames?



More information about the R-help mailing list