[R] problem on using read.csv function
jwiley.psych at gmail.com
Fri Oct 22 04:22:46 CEST 2010
This suggests that those columns have something in them that is not
numeric (e.g., "." to represent missing data, text, etc.). You can
avoid them being converted to factor using:
read.csv("yourfile.csv", stringsAsFactors = FALSE)
however, they will still be character class, not numeric. You will
then either need to use as.numeric() on those columns, or figure out
what is making R think those are character columns in the first place
and correct that in your CSV file.
On Thu, Oct 21, 2010 at 7:17 PM, mou sonia <paperhome at gmail.com> wrote:
> 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.
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Ph.D. Student, Health Psychology
University of California, Los Angeles
More information about the R-help