getage {eye} | R Documentation |
getage
Description
calculates age in years, as durations or periods
Usage
getage(from_date, to_date = lubridate::now(), period = FALSE, dec = 1)
Arguments
from_date |
start date |
to_date |
end date |
period |
Calculating period (TRUE) or duration (FALSE- default) |
dec |
How many decimals are displayed |
Value
Numeric vector
Author(s)
Antoine Fabri and Tjebo Heeren
See Also
OP on stackoverflow from which this function was inspired. Read about periods and durations
Examples
getage("1984-10-16")
dob <- c("1984-10-16", "2000-01-01")
test_date <- as.Date(dob) + c(15000, 20000)
getage(dob, test_date)
[Package eye version 1.2.1 Index]