[R] decimal separator from comma to dot

David Winsemius dwinsemius at comcast.net
Fri Aug 9 19:35:56 CEST 2013


On Aug 9, 2013, at 7:31 AM, maxbre wrote:

> Thanks it's the same thread I've been looking at
> But it's not answering to my  questions…

Please do read the Posting Guide. You are asked to include context. In this case including the citation to the Archive-stored code would have been courteous as well;

 #### not recommended ####
mysub <- function(x) {sub(",",".",x)}
mydata <- (apply(kk, 2, mysub ))
kk1 <- data.frame(apply(mydata, 2, as.numeric))


I would have expected that as.numeric(as.character(x)) to be needed rather than the "factor-mangling" as.numeric() strategy. This IS in the FAQ,
	7.10 How do I convert factors to numeric?
  In this case you only have a single column that is affected so:

   df$POT_TX <- as.numeric(as.character( sub(",", ".", df$POT_TX )))



> View this message in context: http://r.789695.n4.nabble.com/decimal-separator-from-comma-to-dot-tp4673414p4673433.html
> Sent from the R help mailing list archive at Nabble.com.

Nabble tries very hard to confuse its users about the nature of Rhelp. It even omits the message below when posting content.
> 
> 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.

So, maxbre,  please do step up to your responsibilities. You've been posting to rhelp for a year and have 58 posts per the Markmail search engine.

-- 
David Winsemius
Alameda, CA, USA



More information about the R-help mailing list