[R] Characters To Matrix

Dieter Menne dieter.menne at menne-biomed.de
Tue Mar 3 09:56:15 CET 2009


Bob Roberts <quagmire54321 <at> yahoo.com> writes:

>    I have a data set that I read in using readLines, but R classes it as a
character string. The data set has
> multiple columns and rows, but I only want the first 2 columns in the form of
a matrix. Thanks for the help.

data(CO2)
str(CO2)
col2 = as.matrix(CO2[,1:2])
str(col2)


Dieter




More information about the R-help mailing list