nonoverlapping: Compute overlaps of two sets of detached and sorted intervals

overlapsR Documentation

Compute overlaps of two sets of detached and sorted intervals

Description

Find intervals satisfying particular conditions, including corresponding base R functions intersect (i.e. find intersections of intervals), union (i.e. unions of intervals) and setdiff (i.e. finding intervals which are contained in one set of intervals but not another).

Usage

overlaps(x, y, check = TRUE, in_x = TRUE, in_y = TRUE, op = "and")

intersects(x, y, ...)

unions(x, y, ...)

setdiffs(x, y, ...)

Arguments

x

Integer matrix of two columns, the first column giving the (inclusive) start points of intervals and the second column giving the corresponding (exclusive) end points.

y

Same as x.

check

Boolean value determining whether to check that the intervals specified in arguments x and y are sorted and non-overlapping (uses function detached_sorted_nonempty). Defaults to TRUE, but setting to FALSE may allow faster execution.

in_x

Boolean value determining whether to flag TRUE on intervals contained in x.

in_y

Boolean value determining whether to flag TRUE on intervals contained in y.

op

Character value specifying operator used to combine flags for each interval, either "and" or "or".

...

Additional arguments to be passed to overlaps.

Value

Intervals represented by integer matrix of two columns.

Examples

intersects(cbind(1, 3), cbind(2, 4))
setdiffs(cbind(1, 3), cbind(2, 4))
unions(cbind(1, 3), cbind(2, 4))

IntervalSurgeon documentation built on April 15, 2023, 5:07 p.m.