date_to_age_quarter: Convert dates to quarter (three-month) age groups

Description Usage Arguments Details Value See Also Examples

View source: R/date_to_age.R

Description

Use dates of events and dates of birth to

Usage

1

Arguments

date

Dates of events. A vector of class Date, or a vector that can be coerced to class Date using function as.Date.

dob

Dates of birth. A vector of class Date, or a vector that can be coerced to class Date using function as.Date.

Details

date and dob must have the same length, unless one of them has length 1, in which case the length-1 argument is recycled.

Value

an integer vector with the same length as date or dob, whichever is longer.

See Also

The output from date_to_age_quarter is typically processed further using function format_age_quarter.

Other functions for creating age groups from dates are date_to_age_year and date_to_age_month.

Other functions for creating one-quarter intervals from dates are date_to_period_quarter, date_to_cohort_quarter, and date_to_triangle_quarter.

Examples

1
2
3
4
5
6
7
8
9
date_to_age_quarter(date = c("2024-03-27",
                             "2022-11-09"),
                    dob = c("2001-03-21",
                            "2000-07-13"))

## replicate date of event
date_to_age_quarter(date = "2024-03-27",
                    dob = c("2001-03-21",
                            "2000-07-13"))

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