How to tell what is in one vector and not another?

r, vector

Solution

you can use the setdiff() (set difference) function:

> setdiff(x, y)
[1] 1

Problem

In matlab there is a way to find the values in one vector but not in the other. for example: ``` x <- c(1,2,3,4) y <- c(2,3,4) ``` is there any function that would tell me that the value in `x` that's not in `y` is 1?

Original source

Related problems