[R] convert factor data to numeric

S Devriese sdmaillist at gmail.com
Wed Jan 13 19:03:44 CET 2010

On 01/13/2010 05:41 PM, Peter Ehlers wrote:
> S Devriese wrote:
>> On 01/13/2010 10:47 AM, Ahmet Temiz wrote:
>>> hello
>>>  could you give me a hint to convert data in factor type to numeric
>>> (float) ?
>>>   regards
>>> -- 
>>> Open WebMail Project (http://openwebmail.org)
>> you could try as.numeric but without more details it is difficult to see
>> if this will work. How did you end up with a factor (e.g. through
>> import)?
> No, don't use as.numeric(). Do follow Dimitris' advice.
> But the question of how you got the factor data is good; you
> can usually avoid getting factors to begin with.
>  -Peter Ehlers
>> Stephan
>> ______________________________________________
>> R-help at 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.

I know, slightly sloppy answer (see Dimitri's answer), but I hoped to
find out how he got the factor in the first place, because if it is an
import issue (and e,g. decimal character is different from the locale
decimal character) the FAQ answer might not work as expected.


More information about the R-help mailing list