boundaries {grates}R Documentation

Access the start (end) dates of a grates vector

Description

Utility functions for accessing the start (end) dates for each element of a grates object and also checking whether a date is contained within that range

Usage

date_start(x)

date_end(x)

date %during% x

Arguments

x

grouped date vector.

date

A scalar ⁠<date>⁠ object.

Value

For date_start and date_end The requested start (end) dates for each element in the input. For ⁠%during%⁠ a logical vector indicating whether the date was present within the range of the tested object.

Examples

dates <- as.Date("2020-01-01") + 1:14

week <- as_isoweek(dates)
date_start(week)
date_end(week)
dates[1L] %during% week

period <- as_period(dates, n = 3)
date_start(period)
date_end(period)
dates[14L] %during% period


[Package grates version 1.2.0 Index]