sets {base} | R Documentation |
Performs set union, intersection difference and membership on two vectors.
union(x, y) intersect(x, y) setdiff(x, y) is.element(x, y)
x, y |
vectors (of the same type) contain a sequence of items with no duplicated values. |
Each of union
, intersect
and setdiff
will remove
any duplicated values in the arguments.
A vector of the same type as y
.
B. D. Ripley
x <- sample(1:20, 10) y <- sample(3:23, 7) union(x, y) intersect(x, y) setdiff(x, y) is.element(y, x)