Learn R Programming

rIntervalTree (version 0.1.0)

isOverlap,Interval,numeric-method: isOverlap

Description

Method for checking if an interval is overlapping with a single number (start = end) or an ordered pair of numbers (start < end). Two intervals (start1, end1) and (start2, end2) are overlapping if (end2 >= start1 and start2 <= end1).

Usage

# S4 method for Interval,numeric
isOverlap(theObject, someNumbers)

Arguments

theObject

an Interval object

someNumbers

a vector of one or two numbers to test overlap. If two numbers are provided, they are treated as an interval (start, end)

Value

a logical value TRUE or FALSE

Examples

Run this code
# NOT RUN {
i1 <- new("Interval", start=1.1, end=1.2, key="dummy")
isOverlap(i1, c(1.0, 1.5))
isOverlap(i1, 1.0)
# }
# NOT RUN {
isOverlap(i1, c(2.0, 1.5))  # generate an error
isOverlap(i1, c(1.0, 1.5, 2))  # generate an error
# }

Run the code above in your browser using DataLab