View source: R/60-interval_index-methods.R
| merge.interval_index | R Documentation |
Returns a new interval_index containing every entry from both inputs,
preserving start-position order. On tied start positions, x's entries
precede y's (left-biased FIFO).
## S3 method for class 'interval_index'
merge(x, y, ...)
x |
An |
y |
An |
... |
Unused. |
The merge runs in O(m + n) via a zipper-style traversal on interval starts, with a fast path to O(log(min(m, n))) when the start ranges are disjoint.
Both indices must share the same endpoint type and the same bounds
convention (e.g. "[)" half-open vs. "[]" closed), and the same
monoid set. Mismatches error.
The reserved monoids .ivx_min_end / .ivx_max_end recompute
automatically on the merged tree, so min_endpoint() / max_endpoint()
and interval-relation queries work immediately on the result.
Both inputs are left unmodified.
A new interval_index of size length(x) + length(y).
a <- interval_index("A1", "A2", start = c(1, 5), end = c(4, 8))
b <- interval_index("B1", "B2", start = c(3, 7), end = c(6, 10))
m <- merge(a, b)
as.list(m)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.