Pairs is a Vector that stores two parallel vectors (any
object that can be a column in a DataFrame). It
provides conveniences for performing binary operations on the vectors,
as well as for converting between an equivalent list
representation. Virtually all of the typical R vector operations
should behave as expected.
A typical use case is representing the pairing from a
findOverlaps call, for which
findOverlapPairs is a shortcut.
Arguments
Constructor
Pairs(first, second, ..., names = NULL, hits = NULL):
Constructs a Pairs object by aligning the vectors first and
second. The vectors must have the same length, unless
hits is specified. Arguments in ... are combined
as columns in the mcols of the result. The names
argument specifies the names on the result. If hits is not
NULL, it should be a Hits object that
collates the elements in first and second to produce
the corresponding pairs.
Accessors
In the code snippets below, x is a Pairs object.
names(x), names(x) <- value:
get or set the names
first(x), first(x) <- value:
get or set the first member of each pair
second(x), second(x) <- value:
get or set the second member of each pair
Coercion
zipup(x): Interleaves the Pairs object
x into a list, where each element is composed of a
pair. The type of list depends on the type of the elements.
zipdown(x): The inverse of zipup(). Converts
x, a list where every element is of length 2, to a
Pairs object, by assuming that each element of the list
represents a pair.