[R] read.csv converts "NA" to missing values

peter dalgaard pdalgd at gmail.com
Mon Feb 27 15:24:06 CET 2012

On Feb 27, 2012, at 14:15 , nikhil abhyankar wrote:

> Hello,
> I have a CSV file with region codes listed in a column. E.g. 'AS' for Asia,
> 'AU' for Australia and 'NA' North America.
> However, the data frame created using read.csv shows <NA> where the string
> variable should have had the value 'NA'.
> How can I input the value 'NA' present in a column in a CSV file without R
> changing it to missing?

I'd try na.strings="" (or maybe NULL or character(0))


> Thanks
> Nikhil
> 	[[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.

Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com

More information about the R-help mailing list