powered by
calculates age in years, as durations or periods
getage(from_date, to_date = lubridate::now(), period = FALSE, dec = 1)
start date
end date
Calculating period (TRUE) or duration (FALSE- default)
How many decimals are displayed
Numeric vector
OP on stackoverflow from which this function was inspired. Read about periods and durations
# NOT RUN { getage("1984-10-16") dob <- c("1984-10-16", "2000-01-01") test_date <- as.Date(dob) + c(15000, 20000) getage(dob, test_date) # }
Run the code above in your browser using DataLab