[R] Odp: How to read percentage and currency data?

Petr PIKAL petr.pikal at precheza.cz
Wed Feb 24 15:58:09 CET 2010


Hi

r-help-bounces at r-project.org napsal dne 24.02.2010 13:45:59:

> 
> Petr, I've tried that conversion but I get only rounded integer values. 
So
> 585% becomes 6 , 101% becomes 1 etc.

You most probably used only as.numeric(some.data), without stripping off a 
percent sign and you got numeric representation of factor values to which 
data were transformed during import.

First you need to get rid of "%" either by Ista's solution or mine. You 
shall get vector of class character and only than you can use as.numeric.

Regards
Petr

> 
> I've also tried as.double and as.real but still get the same results.
> 
> -----
> Try  http://prettygraph.com Pretty Graph , the easiest way to make 
R-powered
> graphs on the web.
> -- 
> View this message in context: 
http://n4.nabble.com/How-to-read-percentage-and-
> currency-data-tp1567318p1567407.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