Skip to contents

# Extracting date of birth from CPR

Source: `R/cpr_tools.R`
`cpr_dob.Rd`

For easy calculation. Does not handle cprs with letters (interim cpr)

## Usage

    cpr_dob(cpr, format = "%d-%m-%Y")

## Arguments

cpr

  cpr-numbers as ddmmyy"-."xxxx or ddmmyyxxxx. Also mixed formatting. Vector or data frame column.

format

  character string of dob date format. Default is "%d-%m-%Y".

## Value

character vector

## Examples

    cpr_dob("231045-0637")
    #> [1] "23-10-1945"
    fsd<-c("2310450637", "010190-2000", "010115-4000",
    "300450-1030","010150-4021")
    cpr_dob(fsd)
    #> [1] "23-10-1945" "01-01-1990" "01-01-2015" "30-04-1950" "01-01-1950"