Description Usage Arguments Details Value See Also Examples
Use dates of events and dates of birth to create one-year age groups.
1 | date_to_age_year(date, dob)
|
date |
Dates of events.
A vector of class |
dob |
Dates of birth.
A vector of class |
date
and dob
must have the same length,
unless one of them has length 1, in which case the
argument with length 1 is recycled.
an integer vector with the same length as
date
or dob
, whichever
is longer.
The output from date_to_age_year
is often processed further using function
format_age_year
.
Other functions for creating
age groups from dates are
date_to_age_quarter
and date_to_age_month
.
Other functions for creating one-year
units from dates are
date_to_period_year
,
date_to_cohort_year
,
and date_to_triangle_year
.
1 2 3 4 5 6 7 8 9 | date_to_age_year(date = c("2024-03-27",
"2022-11-09"),
dob = c("2001-03-21",
"2000-07-13"))
## replicate date of birth
date_to_age_year(date = c("2024-03-27",
"2022-11-09"),
dob = "2011-05-18")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.