1:2 %in% rep(1:2,5) #[1] TRUE TRUE rep(1:2,5) %in% 1:2 #[1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #Note this output is longer in second