[R] Handling missing data

Erik Iverson eiverson at NMDP.ORG
Fri Oct 9 18:02:08 CEST 2009


1) No need to post multiple times to the list
2) use the is.na function to test if a value is missing, not == or != 

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> On Behalf Of premmad
> Sent: Friday, October 09, 2009 5:05 AM
> To: r-help at r-project.org
> Subject: Re: [R] Handling missing data
> 
> 
> I have one column
> x
> 97
> 94
> 91
> 90
> NA
> NA
> NA
> NA
> I tried
> i tried  this
> book$r<-ifelse(book$x!=NA,book$x+20,10)
> expected result
> 107
> 104
> 101
> 100
> 10
> 10
> 10
> 10
> 
> But got empty column of variable r.How to work with missing values of
> numeric variables.
> Why the numeric variable missing is assigned NA but not .,help in easy
> work
> for us.
> --
> View this message in context: http://www.nabble.com/Handling-missing-data-
> tp25539335p25818365.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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.




More information about the R-help mailing list