Description Usage Arguments Details Value See Also Examples
A merge
method for vector-like objects.
1 2 |
x, y, ... |
Vector-like objects, typically all of the same class and typically not list-like objects (even though some list-like objects like IntegerRanges and DNAStringSet are supported). Duplicated elements in each object are removed with a warning. |
all |
|
all.x, all.y |
To be used only when merging 2 objects (binary merge).
Both If |
sort |
Whether to sort the merged result. |
This merge
method acts much like merge.data.frame
,
except for 3 important differences:
The matching is based on the vector values, not arbitrary columns in a table.
Self merging is a no-op if sort=FALSE
(or object already
sorted) and if the object has no duplicates.
This merge
method accepts an arbitrary number of vector-like
objects (n-ary merge).
If some of the objects to merge are list-like objects not supported by
the method described here, then the merging is simply done by calling
base::merge()
on the objects. This might succeed or not...
A vector-like object of the same class as the input objects (if they all have the same class) containing the merged vector values and metadata columns.
The Vector class.
Vector-comparison for comparing and ordering vector-like objects.
Vector-setops for set operations on vector-like objects.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | library(GenomicRanges)
x <- GRanges(c("chr1:1-1000", "chr2:2000-3000"),
score=c(0.45, 0.1), a1=c(5L, 7L), a2=c(6, 8))
y <- GRanges(c("chr2:150-151", "chr1:1-10", "chr2:2000-3000"),
score=c(0.7, 0.82, 0.1), b1=c(0L, 5L, 1L), b2=c(1, -2, 1))
merge(x, y)
merge(x, y, all=TRUE)
merge(x, y, all.x=TRUE)
merge(x, y, all.y=TRUE)
## Shared metadata columns must agree:
mcols(x)$score[2] <- 0.11
#merge(x, y) # error!
## NAs agree with anything:
mcols(x)$score[2] <- NA
merge(x, y)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.