Remember that NA and other similar entries can be confusing. Following the @ mdsumner example:
> x <- c(1:10,NA,NaN,Inf)
> x > 5
[1] FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE TRUE TRUE NA NA
[13] TRUE
> x[x > 5]
[1] 6 7 8 9 10 NA NA Inf
> x[which(x > 5)]
[1] 6 7 8 9 10 Inf