Checking validity of cpr number. Vectorised.
Arguments
- cpr
cpr-numbers as ddmmyy"-."xxxx or ddmmyyxxxx. Also mixed formatting. Vector or data frame column.
Examples
fsd<-c("2310450637", "010190-2000", "010115-4000","300450-1030","010150-4021")
cpr_check("2310450637")
#> OBS: according to new description, not all valid CPR numbers apply to this modulus 11 rule.
#> Please refer to: https://cpr.dk/media/12066/personnummeret-i-cpr.pdf
#> [1] TRUE
cpr_check(fsd)
#> OBS: according to new description, not all valid CPR numbers apply to this modulus 11 rule.
#> Please refer to: https://cpr.dk/media/12066/personnummeret-i-cpr.pdf
#> [1] TRUE FALSE FALSE FALSE FALSE
all(cpr_check(fsd))
#> OBS: according to new description, not all valid CPR numbers apply to this modulus 11 rule.
#> Please refer to: https://cpr.dk/media/12066/personnummeret-i-cpr.pdf
#> [1] FALSE