[R] coerce (list) object to type 'double'

wendy wendy.qiao at utoronto.ca
Sat Feb 20 18:50:43 CET 2010


Dear all,

I am really new to R, and I have problem here. I searched around, but did
not get a solution.

I have a numetrix matrix (20 by 25) saved in .csv. I read it as

>sx<-read.csv("sx.csv",header=F)
Then I try to convert it to numeric using

>sx<-as.numeric(sx)
Error: (list) object cannot be coerced to type 'double'
The class of sx is  "data.frame".

I tried to unlist it as, 
s<-unlist(sx), but when I look at the dimension,  
> dim(s)
NULL

Can anyone tell me how should I load my data as a numeric matrix rather than
"data.frame", or how to convert the data.frame matrix into numeric?

Thank you very much.
Wendy 
-- 
View this message in context: http://n4.nabble.com/coerce-list-object-to-type-double-tp1562988p1562988.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list