age {cprr}R Documentation

Age

Description

Calculate ages from CPR numbers.

Usage

age(cpr, date = Sys.Date(), unit = "year")

Arguments

cpr

Character vector of CPR numbers with or without hyphens.

date

Character or date vector of dates used in computation of ages. Dates provided as characters must follow the ISO standard, 'yyyy-mm-dd'.

unit

Character indicating the unit representing ages. Possible values are: 'year', 'month', 'week', 'day'.

Value

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.

Examples

  age(c('1508631111', '1310762222'))


[Package cprr version 0.2.0 Index]