intervals (version 0.15.4)

close_intervals: Re-represent integer intervals with open or closed endpoints

Description

Given an integer interval matrix, adjust endpoints so that all intervals have the requested closure status.

Usage

# S4 method for Intervals_virtual
close_intervals(x)

# S4 method for Intervals_virtual open_intervals(x)

# S4 method for Intervals adjust_closure(x, close_left = TRUE, close_right = TRUE)

# S4 method for Intervals_full adjust_closure(x, close_left = TRUE, close_right = TRUE)

Value

An object of the same class as x, with endpoints adjusted as necessary and all closed(x) set to either TRUE or

FALSE, as appropriate.

Arguments

x

An object of appropriate class, and for which x@type == "Z". If x@type == "R", an error is generated.

close_left

Should the left endpoints be closed or open?

close_right

Should the right endpoints be closed or open?

Examples

Run this code
x <- Intervals(
               c( 1, 5, 10, 1, 6, 20 ),
               closed = c( TRUE, FALSE ),
               type = "Z"
               )

# Empties are dropped
close_intervals(x)
adjust_closure(x, FALSE, TRUE)

# Intervals_full
y <- as( x, "Intervals_full" )
closed(y)[1,2] <- TRUE
open_intervals(y)

Run the code above in your browser using DataLab