Calculates the age of individuals at a given date, based on their date of birth. This uses lubridate functions to calculate an age, which means that leap years are also taken into account.

get_age(DOB, Date)

Arguments

DOB

vector of Date objects to be used as the date of birth

Date

vector of Date objects to be used as the date at which the age is requested

Examples

birthdays <- lubridate::dmy(c("01/01/1990", "29/02/1992", "31/12/2000", "15/06/1995")) get_age(birthdays, lubridate::today())
#> [1] 30 28 19 25