age_years {timeplyr}R Documentation

Accurate and efficient age calculation

Description

Correct calculation of ages in years using lubridate periods. Leap year calculations work as well.

Usage

age_years(start, end = if (is_date(start)) Sys.Date() else Sys.time())

age_months(start, end = if (is_date(start)) Sys.Date() else Sys.time())

Arguments

start

Start date/datetime, typically date of birth.

end

End date/datetime. Default is current date/datetime.

Value

Integer vector of age in years or months.


[Package timeplyr version 0.5.0 Index]