I have two vectors:
a <- c(1, 1, 3, 4, 5, 7, 9) b <- c(2, 3, 4, 6, 8, 2)
I want to find the numbers in the second vector, which are n
An alternative way, instead of setdiff (which is probably preferrable), is to use %in%
setdiff
%in%
unique(b[! b %in% a]) #[1] 2 6 8
You can use setdiff
setdiff(b,a) #[1] 2 6 8