age_calc: Calculating age from date of birth

age_calcR Documentation

Calculating age from date of birth

Description

For age calculations.

Usage

age_calc(dob, enddate = Sys.Date(), units = "years", precise = TRUE)

Arguments

dob

Date of birth. Data format follows standard POSIX layout. Format is yyyy-mm-dd.

enddate

Date to calculate age at. Format is yyyy-mm-dd.

units

Default is "years". Can be changed to "days".

precise

Default is TRUE. Flag set whether to include calculations of spring years. Only of matter if using units = "days".

Examples

  ##Kim Larsen (cpr is known from album)
  dob<-daDoctoR::dob_extract_cpr("231045-0637")
  date<-as.Date("2018-09-30")
  trunc(age_calc(dob,date))

agdamsbo/daDoctoR documentation built on Aug. 30, 2022, 4:29 p.m.