dat1 <- c(1,2,3,4,5,6) dat2 <- c(1,2,3,4,5,7,8,9)
dat2 %in% dat1
It would help to have a n actual data set.