View source: R/compute_age_years.R
compute_age_years | R Documentation |
Converts a set of age values from the specified time unit to years.
compute_age_years(age, age_unit)
age |
The ages to convert. A numeric vector is expected. |
age_unit |
Age unit. Either a string containing the time unit of all ages in Permitted Values: |
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).
The ages contained in age
converted to years.
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()
compute_age_years(
age = c(240, 360, 480),
age_unit = "MONTHS"
)
compute_age_years(
age = c(10, 520, 3650, 1000),
age_unit = c("YEARS", "WEEKS", "DAYS", NA_character_)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.