[R] Namibia becoming NA

Joshua Wiley jwiley.psych at gmail.com
Sun Jul 18 08:36:54 CEST 2010


Hi Suresh,

I think you will need to use read.table() rather than the read.csv()
wrapper for it.  Try:

input <- read.table(file = "padded.csv", sep = ",", header = TRUE,
na.strings = NULL)

HTH,

Josh

On Sat, Jul 17, 2010 at 10:47 PM, Suresh Singh <singh.258 at osu.edu> wrote:
> I have a data file in which one of the columns is country code and NA is the
> code for Namibia.
> When I read the data file using read.csv, NA for Namibia is being treated as
> null or "NA"
>
> How can I prevent this from happening?
>
> I tried the following but it didn't work
> input <- read.csv("padded.csv",header = TRUE,as.is = c("code2"))
>
> thanks,
> Suresh
>
>        [[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.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/



More information about the R-help mailing list