getage: getage

Description Usage Arguments Value Author(s) See Also Examples

View source: R/tools.R

Description

calculates age in years, as durations or periods

Usage

1
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

1
2
3
4
5
getage("1984-10-16")

dob <-  c("1984-10-16", "2000-01-01")
test_date <-  as.Date(dob) + c(15000, 20000)
getage(dob, test_date)

tjebo/eye documentation built on Jan. 24, 2022, 8:34 p.m.