find_matching_intervals: Find intervals containing a set of points

Description Usage Arguments Value Examples

Description

Find intervals containing a set of points

Usage

1

Arguments

pos

Double vector of positions

start

Double vector with left endpoints of intervals

end

Double vector with right endpoints of intervals

Value

A list with elements "position" and "interval". Both are integer vectors containing indexes. The "position" vector indexes the pos vector and the "interval" vector the start and end vectors. The kth index in the "position" vector forms a pair with the kth index in the "interval" vector. A pair of indexes (i,j) means that pos[i] belongs to the interval defined by start[j] and end[j].

Examples

1
2
3
x <- find_matching_intervals(c(2, 7), c(5, 0, 2), c(9, 1, 3))
stopifnot(identical(x$position, c(1L, 2L)))
stopifnot(identical(x$interval, c(3L, 1L)))

cbaumbach/miscFun documentation built on May 13, 2019, 1:48 p.m.