within-interval: Tests whether a date or interval falls within an interval

Description Usage Arguments Value Examples

Description

If a is an interval, both its start and end dates must fall within b to return TRUE.

Usage

1
a %within% b

Arguments

a

An interval or date-time object

b

An interval

Value

A logical

Examples

1
2
3
4
5
6
int <- interval(ymd("2001-01-01"), ymd("2002-01-01"))
int2 <- interval(ymd("2001-06-01"), ymd("2002-01-01"))

ymd("2001-05-03") %within% int # TRUE
int2 %within% int # TRUE
ymd("1999-01-01") %within% int # FALSE

Example output

Attaching package: 'lubridate'

The following object is masked from 'package:base':

    date

[1] TRUE
[1] TRUE
[1] FALSE

lubridate documentation built on Nov. 17, 2017, 6:56 a.m.