[R] I need to change from character to numeric?

Williams, Robin robin.williams at metoffice.gov.uk
Fri Aug 29 12:14:19 CEST 2008


There was a very informative thread on this list only a week or so ago (I started it!). If you're reading from a table or a csv file, see the colClasses argument. Otherwise see ?as.numeric.  


Robin Williams 
Met Office summer intern - Health Forecasting 
robin.williams at metoffice.gov.uk 
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Samuel Bächler
Sent: Friday, August 29, 2008 1:09 PM
To: r-help at r-project.org
Subject: Re: [R] I need to change from character to numeric?

>  I am reading numeric data as below but the problem is the object
>  ndata1 and nd1 have characters instead of numeric values. I want to  
> keep it as numeric. Why the type has changed from numeric to  
> character and how to avoid this problem?

help(as.numeric)

Your variable rdata1 has probably character-type.

s.

______________________________________________
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.



More information about the R-help mailing list