Learn R Programming

intervals (version 0.15.5)

empty: Identify empty interval rows

Description

A valid interval matrix may contain empty intervals: those with common endpoints, at least one of which is open. The empty method identifies these rows.

Usage

# S4 method for Intervals
empty(x)

# S4 method for Intervals_full empty(x)

Value

A boolean vector with length equal to nrow(x).

Arguments

x

An "Intervals" or "Intervals_full" object.

Warning

Exact equality (==) comparisons are used by empty. See the package vignette for a discussion of equality and floating point numbers.

Details

Intervals are deemed to be empty when their endpoints are equal and not both closed, or for type == "Z", when their endpoints differ by 1 and both are open. The matrices x and x[!empty(x),] represent the same subset of the integers or the real line.

See Also

See size to compute the size of each interval in an object.

Examples

Run this code
z1 <- Intervals( cbind( 1, 1:3 ), type = "Z" )
z2 <- z1; closed(z2)[1] <- FALSE
z3 <- z1; closed(z3) <- FALSE

empty(z1)
empty(z2)
empty(z3)

r1 <- z1; type(r1) <- "R"
r2 <- z2; type(r2) <- "R"
r3 <- z3; type(r3) <- "R"

empty(r1)
empty(r2)
empty(r3)

s1 <- Intervals_full( matrix( 1, 3, 2 ), type = "Z" )
closed(s1)[2,2] <- FALSE
closed(s1)[3,] <- FALSE

empty(s1)

Run the code above in your browser using DataLab