mardi 18 avril 2017

as.numeric function in R with no funny results

I have a column of data of character class with 17700 values which looks like this:

410.9
564
784.7
100070.0
724.5
...

I want to convert this data into numbers, however, my code:

data1$ICDCode <- as.numeric(levels(data1$ICDCode))[data1$ICDCode]

turns all the values into NAs. I don't think this is because of the decimal point since not all my data values include it (but they all turn into NAs too). How can I convert my data into numeric class?






Comments
0 Comments

0 commentaires:

Enregistrer un commentaire