jan_1_to_5 <- interval(as.Date("2000-01-01"), as.Date("2000-01-05"))
jan_2_to_4 <- interval(as.Date("2000-01-02"), as.Date("2000-01-04"))
jan_3_to_9 <- interval(as.Date("2000-01-03"), as.Date("2000-01-09"))
phint_within(
c(jan_2_to_4, jan_3_to_9, jan_1_to_5),
c(jan_1_to_5, jan_1_to_5, NA)
)
phint_within(as.Date(c("2000-01-06", "2000-01-20")), jan_3_to_9)
# Intervals are within themselves
phint_within(jan_1_to_5, jan_1_to_5)
# By default, interval endpoints are considered within
phint_within(as.Date("2000-01-01"), jan_1_to_5)
# Use bounds to consider intervals as exclusive of endpoints
phint_within(as.Date("2000-01-01"), jan_1_to_5, bounds = "()")
# Holes are never within any interval (including other holes)
hole <- hole()
phint_within(c(hole, hole), c(hole, jan_1_to_5))
Run the code above in your browser using DataLab