get_age {PAutilities} | R Documentation |
Calculate age
Description
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).
Usage
get_age(birthdate, current_date, units = c("years", "months"))
Arguments
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 |
Value
Numeric value giving age in the specified units.
Examples
get_age(as.Date("2000-01-01"), Sys.Date(), "years")
[Package PAutilities version 1.2.1 Index]