Start or end date of the period containing each date
Source:R/period_completeness.R
period_bounds.Rdperiod_start_date() and period_end_date() return the first and last
calendar day of the period containing each date. They are thin, coercing,
vectorized wrappers around lubridate::floor_date() and
lubridate::ceiling_date() that always return a lubridate::Date (never a datetime)
and validate unit.
The returned dates are always canonical calendar boundaries. Business-day
calendars are used only to judge completeness (see period_is_complete()),
never to compute a boundary date.
Arguments
- date
A vector of dates (Date or coercible with
lubridate::as_date()).- unit
Period size, one of
"week","month","quarter", or"year".- week_start
Integer 1-7 giving the first day of the week (only used when
unit = "week"). Defaults togetOption("lubridate.week.start", 7), so the package defers to the session's lubridate week convention.