Converts a set of age values from the specified time unit to years.
compute_age_years(age, age_unit)
The ages to convert.
A numeric vector is expected.
none
Age unit.
Either a string containing the time unit of all ages in age
or a character
vector containing the time units of each age in age
is expected. Note that
permitted values are cases insensitive (e.g. "YEARS"
is treated the same
as "years"
and "Years"
).
"years"
, "months"
, "weeks"
, "days"
, "hours"
, "minutes"
,
"seconds"
, NA_character_
.
none
The ages contained in age
converted to years.
Returns a numeric vector of ages in years as doubles. Note
that passing NA_character_
as a unit will result in an NA
value for the outputted
age. Also note, underlying computations assume an equal number of days in each
year (365.25).
Date/Time Computation Functions that returns a vector:
compute_dtf()
,
compute_duration()
,
compute_tmf()
,
convert_date_to_dtm()
,
convert_dtc_to_dt()
,
convert_dtc_to_dtm()
,
impute_dtc_dt()
,
impute_dtc_dtm()