Calculate ages from CPR numbers.
age(cpr, date = Sys.Date(), unit = "year")
Character vector of CPR numbers with or without hyphens.
Character or date vector of dates used in computation of ages. Dates provided as characters must follow the ISO standard, 'yyyy-mm-dd'.
Character indicating the unit representing ages. Possible values are: 'year', 'month', 'week', 'day'.
Numeric vector of ages. By default ages are computed in years. Note that year and month units are calculated by approximaion, 1 year = 365.25 days, 1 month = 30.44 days.
# NOT RUN {
age(c('1508631111', '1310762222'))
# }
Run the code above in your browser using DataLab