intersected: Determine whether each interval in a given set are...

View source: R/functions.R

intersectedR Documentation

Determine whether each interval in a given set are intersected/covered by intervals in another set

Description

Compute a logical vector indicating whether corresponding intervals specified by x overlap (intersected)/are covered by (covered) those in by_intervals.

Usage

intersected(x, by_intervals)

covered(x, by_intervals)

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, or, an integer vector specifying the location of points.

by_intervals

Matrix specifying intervals to test for intersection of.

Value

Logical vector with elements corresponding to rows of x.

Examples

intersected(rbind(c(1, 2), c(49, 51), c(50, 200)), rbind(c(50, 100)))
covered(rbind(c(1, 10), c(49, 51), c(50, 200)), rbind(c(2, 60)))

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