Learn R Programming

phinterval (version 1.0.0)

is_hole: Test for empty intervals

Description

is_hole() checks for <hole> (empty) time spans in phint.

Usage

is_hole(phint)

Value

A logical vector the same length as phint.

Arguments

phint

[phinterval / Interval]

A <phinterval> or <Interval> vector.

Examples

Run this code
# Detect holes
y2000 <- interval(as.Date("2000-01-01"), as.Date("2001-01-01"))
y2025 <- interval(as.Date("2025-01-01"), as.Date("2025-01-01"))
is_hole(c(hole(), y2000, hole(), y2025, NA))

# The intersection of disjoint intervals is a hole
is_hole(phint_intersect(y2000, y2025))

Run the code above in your browser using DataLab