Are you looking for "any"?
> x<-c(1,2,3,4,5) > x==5 [1] FALSE FALSE FALSE FALSE TRUE > any(x==5) [1] TRUE
Note that you can also do this for strings
> x<-c("a","b","c","d") > any(x=="b") [1] TRUE > any(x=="e") [1] FALSE
And this can be convenient when combined:
> sapply(c(2,4,6,8,10), function(x){ x%%2==0 } ) [1] TRUE TRUE TRUE TRUE TRUE > any(sapply(c(2,4,6,8,10), function(x){ x%%2!=0 } )) [1] FALSE
Arcymag
source share