date_to_cohort_quarter: Convert dates to quarter (three-month) cohorts

Description Usage Arguments Value See Also Examples

View source: R/date_to_cohort.R

Description

Assign dates to one-quarter (three-month) cohorts. Quarters are defined as follows:

Quarter Start End
Q1 1 January 31 March
Q2 1 April 30 June
Q3 1 July 30 September
Q4 1 October 31 December

Usage

1

Arguments

date

Dates of events defining cohorts (typically births). A vector of class Date, or a vector that can be coerced to class Date via function as.Date.

Value

A character vector with the same length as date.

See Also

The output from date_to_cohort_quarter is often processed further using format_cohort_quarter.

Other functions for creating cohorts from dates are date_to_cohort_quarter and and date_to_cohort_month.

Other functions for creating one-quarter units from dates are date_to_age_quarter, date_to_period_quarter, and date_to_triangle_quarter. The interface for date_to_cohort_quarter is identical to that of date_to_period_quarter.

Examples

1
2
3
date_to_cohort_quarter(date = c("2024-03-27",
                                "2022-11-09",
                                "2023-05-11"))

johnrbryant/demprep documentation built on Dec. 31, 2021, 11:58 a.m.