Displaying 1 result from an estimated 1 matches for "flomux".
2002 Apr 08
2
subsetting with NA's
...ta.frame(a = c("x", "y", "z"), b = c(1, NA, 5))
> x
a b
1 x 1
2 y NA
3 z 5
I realize that, if I know the values in x$b that I want to subset, things are easy:
> x[x$b %in% c(1),]
a b
1 x 1
However, if I only know the *range", then the NA's will flomux me.
> x[x$b < 3,]
a b
1 x 1
NA NA NA
Of course, I can explicitly avoid the NA's by doing something like:
> x[x$b < 3 & ! is.na(x$b),]
a b
1 x 1
My problem is that this sort of syntax can become quite annoying when their are
many variables in the subseting expressio...