Hi

Please include context.

Your "numbers" are not numbers. They are strings in csv file e.g. "1,200,300" 
and are converted to factors during reading. 

First do not convert them to factors by stringsAsfactors=FALSE option in 
read.table.

If you are sure that all commas are thousands separators (in my country comma 
is used as decimal point) you can do

as.numeric(paste(unlist(strsplit("1,200,300", ",")), collapse=""))

or

tonum <- fumction (x) as.numeric(paste(unlist(strsplit(x, ",")), collapse=""))

tonum(some column of values)

Regards
Petr

> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of eric
> Sent: Friday, November 16, 2012 3:19 AM
> To: r-help@r-project.org
> Subject: Re: [R] Dealing with factors ???
> 
> The table is much bigger than what was shown. I just displayed a few
> rows.
> Seems like there should be a better way that the approach you are
> proposing.
> What is also not clear to me is why the factors are coming at all. I do
> a read.csv on a table full of numbers from excel and I'm seeing factors
> everywhere.
> 
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Dealing-
> with-factors-tp4649686p4649689.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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.

______________________________________________
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