Re-represent integer intervals with open or closed endpoints
Given an integer interval matrix, adjust endpoints so that all intervals have the requested closure status.
1 2 3 4 5 6 7 8 9 10 11
## S4 method for signature 'Intervals_virtual' close_intervals(x) ## S4 method for signature 'Intervals_virtual' open_intervals(x) ## S4 method for signature 'Intervals' adjust_closure(x, close_left = TRUE, close_right = TRUE) ## S4 method for signature 'Intervals_full' adjust_closure(x, close_left = TRUE, close_right = TRUE)
An object of appropriate class, and for which
Should the left endpoints be closed or open?
Should the right endpoints be closed or open?
An object of the same class as
x, with endpoints adjusted as
necessary and all
closed(x) set to either
FALSE, as appropriate.
open_intervals are for
convenience, and just call
adjust_closure with the approriate
x object may contain empty intervals, with at least one
open endpoint, and still be valid. (Intervals are invalid if their
second endpoint is less than their first.) The
method would, in such cases, create an invalid result; to prevent
this, empty intervals are detected and removed, with a warning.
This package does not make a distinction between closed and open
infinite endpoints: an interval with an infinite endpoint extends to
(plus or minus) infinity regardless of the closure state. For example,
distance_to_nearest will return a
Inf is compared to both
"[0, Inf)" and
1 2 3 4 5 6 7 8 9 10 11 12 13 14