get_age | R Documentation |
Takes two Date objects and calculates age based on
difftime
(in days) divided by 365.2425 days per year (for
age in years) or 30.4375 days per month (for age in months).
get_age(birthdate, current_date, units = c("years", "months"))
birthdate |
Date object giving the date of birth |
current_date |
Date object giving the date from which age is to be calculated |
units |
The units in which age should be reported |
Numeric value giving age in the specified units.
get_age(as.Date("2000-01-01"), Sys.Date(), "years")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.