[R] convert a Character-string to a number

Laurent Faisnel laurent.faisnel at ariase.com
Fri Sep 12 14:44:31 CEST 2003


Michael Kirschbaum wrote:

> how can I convert the vector
> 
> a<-c("0,01","1,00")
> in a vector 
> b<-c(0.01,1.00)

What is your decimal delimiter ? '.' or ',' ?
If it is ',' you should change it into '.' and then as.numeric() works 
just fine.
If it is '.' it won't work.

HTH,
Laurent




More information about the R-help mailing list