int_overlaps {lubridate}R Documentation

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

int1 <- interval(ymd("2001-01-01"), ymd("2002-01-01"))
# 2001-01-01 UTC--2002-01-01 UTC
int2 <- interval(ymd("2001-06-01"), ymd("2002-06-01"))
# 2001-06-01 UTC--2002-06-01 UTC
int3 <- 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

[Package lubridate version 1.5.6 Index]