age | R Documentation |
By default, calculates the typical "age in years", with a
floor applied so that you are, e.g., 5 years old from
5th birthday through the day before your 6th birthday. Set
floor = FALSE
to return decimal ages, and change units
for units other than years.
age(dob, ageDay = Sys.Date(), units = "years", floor = TRUE)
dob |
date-of-birth, the day to start calculating age. |
ageDay |
the date on which age is to be calculated. |
units |
unit to measure age in. Defaults to "years". Passed to duration. |
floor |
boolean for whether or not to floor the result. Defaults to TRUE. |
Age in units. Will be an integer if floor = TRUE.
mydob <- as.Date('1983-10-20')
age(mydob)
age(mydob, units = "minutes")
age(mydob, floor = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.