[R] subset with NA
white.denis@epamail.epa.gov
white.denis at epamail.epa.gov
Thu Feb 20 02:22:02 CET 2003
> Easy question that I can't find an answer for. I'm trying to subset a
> data frame and want to exclude the positive values, i.e. I want the NA
> values.
>
> My data:
> > summary(temp$tuna)
> Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
> 1 2 3 3 4 5 1211
>
> Querying for
> subset(temp, tuna %in% "NA", select....
> subset(temp, tuna == NA, select....
> subset(temp, tuna == as.character(NA), select....
>
> All yield an empty data frame.
>
> An R-help post
> (http://www.r-project.org/nocvs/mail/r-help/2002/3645.html) suggested
> looking at http://developer.r-project.org/150update.txt, which I did
> but I'm confused as to how to accurately query for an NA string.
subset (temp, is.na (temp$tuna), ...)
More information about the R-help
mailing list