Skip to contents

Age in some units

Usage

age_in_unit(
  DOB,
  REFDATE = Sys.Date(),
  years = TRUE,
  months = TRUE,
  weeks = TRUE,
  days = TRUE
)

Arguments

DOB, REFDATE

Two dates

years, months, weeks, days

the units.

Examples

DOB <- as.Date("1989-08-05")
TODAY <- Sys.Date()
age_in_unit(DOB, TODAY)
#> [1] "33 years, 7 months, 1 weeks, 0 days"