[R] Converting text to numbers

David Barron mothsailor at googlemail.com
Wed Sep 27 23:28:37 CEST 2006


> Then, I tried to convert them to numbers using the following.
> > Sample1$FCT2 <- as.numeric(Sample1$FCT2)
> > Sample1$OBS2 <- as.numeric(Sample1$OBS2)


This is actually an FAQ.  Do the following and it should be fine:

> Sample1$FCT2 <- as.numeric(as.character(Sample1$FCT2))
> Sample1$OBS2 <- as.numeric(as.character(Sample1$OBS2))



-- 
=================================
David Barron
Said Business School
University of Oxford
Park End Street
Oxford OX1 1HP



More information about the R-help mailing list