Description Usage Arguments Details Value Author(s) See Also Examples
Perform set operations on Vector objects.
1 2 3 4 5 6 7 8 9 10 11 
x, y 
Vectorlike objects. 
The union
, intersect
, and setdiff
methods for
Vector objects return a Vector object containing respectively
the union, intersection, and (asymmetric!) difference of the 2 sets of
vector elements in x
and y
.
The setequal
method for Vector objects checks for set
equality between x
and y
.
They're defined as follow:
1 2 3 4 5 6 7 8 9 10 11 12 13  setMethod("union", c("Vector", "Vector"),
function(x, y) unique(c(x, y))
)
setMethod("intersect", c("Vector", "Vector"),
function(x, y) unique(x[x %in% y])
)
setMethod("setdiff", c("Vector", "Vector"),
function(x, y) unique(x[!(x %in% y)])
)
setMethod("setequal", c("Vector", "Vector"),
function(x, y) all(x %in% y) && all(y %in% x)
)

so they work outofthebox on Vector objects for which c
,
unique
, and %in%
are defined.
union
returns a Vector object obtained by appending to x
the elements in y
that are not already in x
.
intersect
returns a Vector object obtained by keeping only
the elements in x
that are also in y
.
setdiff
returns a Vector object obtained by dropping from
x
the elements that are in y
.
setequal
returns TRUE
if x
and y
contain the
same sets of vector elements and FALSE
otherwise.
union
, intersect
, and setdiff
propagate the names and
metadata columns of their first argument (x
).
Herv<c3><a9> Pag<c3><a8>s
Vectorcomparison for comparing and ordering vectorlike objects.
Vectormerge for merging vectorlike objects.
Vector objects.
BiocGenerics::union
,
BiocGenerics::intersect
,
and BiocGenerics::setdiff
in the BiocGenerics package for general information about
these generic functions.
1  ## See ?`Hitssetops` for some examples.

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs in the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.