What about this?

Remove the periods and change the "," to a ".":

s <- "12.084.547,17"
x <- as.numeric(gsub(',','\\.', gsub('\\.','',s)))

options(digits=10)
x

Escaping periods is not-so-obvious.

efg

Earl F Glynn
Overland Park, KS

Luis Felipe Parra wrote:
Hello I have a sting of the form "12.084.547,17" which I would like R to
understand as a number which has "," as the decimal separator, does anybody
know how to do this?

thank you

Felipe Parra

        [[alternative HTML version deleted]]


______________________________________________
R-help@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.

Reply via email to