[R] problem on using read.csv function

jim holtman jholtman at gmail.com
Fri Oct 22 04:23:42 CEST 2010


An example would be useful.  Look at what is causing what you think
are numbers to be interpreted as character strings and therefore being
changed to numbers.  For example, are there commas in the numbers, are
some missing and replaced by some character sequence that represents
missing values.  You can always convert the column to numerics:

yourData$col <- as.numeric(as.character(yourData$col))

So there is something in your data that is causing the conversion.
After you do the conversion above, look for NAs in the data. This
might show you were the problem is.

On Thu, Oct 21, 2010 at 10:17 PM, mou sonia <paperhome at gmail.com> wrote:
> Hi,
>
> I'm using read.csv to import a table. But sevel columns are changed to
> factor variables automatically. They are actually numbers not factor levels.
> Why this happened? How can I get the correct table? Thanks a lot.
>
> Sonia
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?



More information about the R-help mailing list