Skip to content

NA when indexing vectors

3 messages · Szilard, Jorge Ivan Velez, Kenneth Cabrera

#
Hello:

Is there a more natural way to get all elements that satisfy a condition
when there are NAs in the sample?
[1] FALSE  TRUE    NA
[1]  2 NA         ## I would expect here to get just "2"
[1] 2

Thanks,
Szilard
#
Maybe you mean:

x[which(x>=2)]


El jue, 21-05-2009 a las 14:34 -0400, Jorge Ivan Velez escribi?: