I'm reading in some data from a csv file, and it's reading in some of the
columns as character variables instead of numeric. I know I can fix this by
doing as.numeric for each of the columns, but the problem is I have a LOT of
different quantitative variables that I would have to do this for.
I've been trying something along the following but it hasn't really been
working
>columns<-c(1,4,6,8,20,22) # where these are the columns that are numeric
workf is the data matrix that I'm working with
So I tried
>workf[,columns]<-as.numeric[,columns]
when I do this I get the error message
Error: (list) object cannot be coerced to type 'double'

I've tried doing it different ways, with a new data matrix Matr and doing
>Matr<-workf
>Matr[,columns]<-as.numeric[,columns]

but it keeps on bringing up the same error message. Could someone help me
with this? Thanks
Sincerely,
Richard

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to