lubridate (version 1.3.3)

int_overlaps: Test if two intervals overlap

Description

Test if two intervals overlap

Usage

int_overlaps(int1, int2)

Arguments

int1
an Interval object
int2
an Interval object

Value

  • Logical. TRUE if int1 and int2 overlap by at least one second. FALSE otherwise.

Examples

Run this code
int1 <- new_interval(ymd("2001-01-01"), ymd("2002-01-01"))
# 2001-01-01 UTC--2002-01-01 UTC
int2 <- new_interval(ymd("2001-06-01"), ymd("2002-06-01"))
# 2001-06-01 UTC--2002-06-01 UTC
int3 <- new_interval(ymd("2003-01-01"), ymd("2004-01-01"))
# 2003-01-01 UTC--2004-01-01 UTC

int_overlaps(int1, int2) # TRUE
int_overlaps(int1, int3) # FALSE

Run the code above in your browser using DataCamp Workspace