You have a lot of different way
a<-c(1,2,3,NA,3,4,3) is.na(a) [1] FALSE FALSE FALSE TRUE FALSE FALSE FALSE a==2 [1] FALSE TRUE FALSE NA FALSE FALSE FALSE Look at here: http://cran.r-project.org/doc/manuals/R-intro.html -- View this message in context: http://r.789695.n4.nabble.com/how-to-test-if-a-vector-contain-a-value-tp2326843p2326868.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.