If your data uses a special marker such as "--" or "n/a" to indicate not 
available then once you have identified those markers (using any method, though 
Don's procedure below is what I use) then you can specify them with the 
na.strings parameter to read.csv. (See the help for read.table for many other 
parameters you can also give to read.csv.) Once those special values are 
specified, then you should get numeric columns just fine.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnew...@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

On November 14, 2014 11:11:20 AM PST, "MacQueen, Don" <macque...@llnl.gov> 
wrote:
>Petr is almost certainly correct. A further suggestion:
>
>Continue to import using stringsAsFactors = FALSE
>
>On one of the columns that should be numeric, use as.numeric(), find
>the
>NA's in the result of that, and then look at those rows of the data.
>There
>will be something there that is non-numeric. By any chance, does your
>data
>use a comma instead of a decimal point (see the "dec" argument to
>read.table)?

______________________________________________
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