sets {BiocGenerics} | R Documentation |
Performs set union, intersection and (asymmetric!) difference on two vector-like objects.
NOTE: This man page is for the union
, intersect
and
setdiff
S4 generic functions defined in the BiocGenerics
package.
See ?base::union
for the default methods
(defined in the base package).
Bioconductor packages can define specific methods for objects
(typically vector-like) not supported by the default methods.
union(x, y, ...) intersect(x, y, ...) setdiff(x, y, ...)
x, y |
Vector-like objects (typically of the same class, but not necessarily). |
... |
Additional arguments, for use in specific methods. |
See ?base::union
for the value returned by the
default methods.
Specific methods defined in Bioconductor packages will typically return an object of the same class as the input objects.
The default methods (defined in the base package) only take 2
arguments. We've added the ...
argument to the generic functions
defined in the BiocGenerics package so they can be called with an
arbitrary number of effective arguments.
For union
or intersect
, this typically allows Bioconductor
packages to define methods that compute the union or intersection of more
than 2 objects. However, for setdiff
, which is conceptually a
binary operation, this typically allows methods to add extra arguments
for controlling/altering the behavior of the operation.
Like for example the ignore.strand
argument supported by the
setdiff
method for GenomicRanges objects
(defined in the GenomicRanges package). (Note that the union
and intersect
methods for those objects also support the
ignore.strand
argument.)
base::union
for the default union
,
intersect
, and setdiff
methods.
showMethods
for displaying a summary of the
methods defined for a given generic function.
selectMethod
for getting the definition of
a specific method.
union,GenomicRanges,GenomicRanges-method in
the GenomicRanges package for examples of specific
union
, intersect
, and setdiff
methods (defined
for GenomicRanges objects).
BiocGenerics for a summary of all the generics defined in the BiocGenerics package.
union showMethods("union") selectMethod("union", c("ANY", "ANY")) # the default method intersect showMethods("intersect") selectMethod("intersect", c("ANY", "ANY")) # the default method setdiff showMethods("setdiff") selectMethod("setdiff", c("ANY", "ANY")) # the default method