Computes the age given a birth year or a birth date
compute_age(x, age_spec = NULL, reference_year = NULL)
a numeric vector of ages
a string or number vector to be transformed
a string indicating the age specification, can be one of
NULL
, "age"
, "birthyear"
, or "date_of_birth"
. If
this parameter is set to NULL
, the function automatically tries to
infers the specification
a number indicating the reference year in order to
compute the age from a birth year or birth date. If age_spec
is
"age"
, this parameter can be ignored.