reduce | R Documentation |
The reduce()
function reduces the provided numeric ranges to
non-overlapping (disjoint) ranges. This is similar to the
IRanges::reduce()
function, but works with numeric
vectors instead of
integer ranges (IRanges
).
reduce(start = numeric(), end = numeric(), .check = TRUE)
start |
|
end |
|
.check |
|
list
of length 2, the first element being the start (mininum)
values for the disjoint ranges, the second the end (maximum) values.
The IRanges package defines a reduce()
method for IRanges
and other
S4 classes. This reduce()
function is not an S4 method, but a function,
thus it is suggested to specifically import it if used in another R package,
or to call it with MsCoreUtils::reduce()
.
Johannes Rainer and Sebastian Gibb
## Define start and end values for the numeric ranges
s <- c(12.23, 21.2, 13.4, 14.2, 15.0, 43.12)
e <- c(12.40, 24.1, 14.4, 16.2, 15.2, 55.23)
reduce(s, e)
## Empty vectors
reduce()
## Single value
reduce(3.12, 34)
## Non-overlapping ranges
reduce(c(3, 9), c(4, 19))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.