[R] comma as a seperator to numeric
Ivan Calandra
ivan.calandra at u-bourgogne.fr
Wed Nov 28 10:50:48 CET 2012
Hi Mat,
You could first replace your commas with points using gsub().
Or you could import your data differently (using read.csv2() for example)
See ?gsub and ?read.csv
HTH,
Ivan
--
Ivan CALANDRA
Université de Bourgogne
UMR CNRS/uB 6282 Biogéosciences
6 Boulevard Gabriel
21000 Dijon, FRANCE
+33(0)3.80.39.63.06
ivan.calandra at u-bourgogne.fr
http://biogeosciences.u-bourgogne.fr/calandra
Le 28/11/12 09:03, Mat a écrit :
> Hello together,
>
> i have a big problem, to convert a column in my data.frame to numeric.
>
> I have:
> 61,13 in the column and write:
> data$PT_DL<-as.numeric(as.character(data$PT_DL))
>
> the result is NA, not a point seperated number.
>
> How can i change the data to an as.numeric number?
>
> Thank you for your help.
>
> Mat
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/comma-as-a-seperator-to-numeric-tp4651090.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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