How to tell what is in one vector and not another?
you can use the setdiff() (set difference) function:
> setdiff(x, y)
[1] 1
Yes. For vectors you can simply use the %in%
operator or is.element()
function.
> x[!(x %in% y)]
1
For a matrix, there are many difference approaches. merge()
is probably the most straight forward. I suggest looking at this question for that scenario.