[R] Converting text to numbers

Dan Chan dchan at GFC.STATE.GA.US
Thu Sep 28 20:08:34 CEST 2006


Hi David,

Thank you for your help.  It worked! 

Daniel Chan

-----Original Message-----
From: David Barron [mailto:mothsailor at googlemail.com] 
Sent: Wednesday, September 27, 2006 9:29 PM
To: Dan Chan; r-help
Subject: Re: [R] Converting text to numbers

> 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