NA when indexing vectors
Hello: Is there a more natural way to get all elements that satisfy a condition when there are NAs in the sample?
x=c(1,2,NA)
x>=2
[1] FALSE TRUE NA
x[x>=2]
[1] 2 NA ## I would expect here to get just "2"
x[!is.na(x) & x>=2] ## seems a bit cumbersome
[1] 2 Thanks, Szilard