| Version: | 0.2.0 | 
| Date: | 2019-03-17 | 
| Type: | Package | 
| Title: | Functions for Working with Danish CPR Numbers | 
| Description: | Calculate date of birth, age, and gender, and generate anonymous sequence numbers from CPR numbers. https://en.wikipedia.org/wiki/Personal_identification_number_(Denmark). | 
| Author: | Jacob Anhoej | 
| Maintainer: | Jacob Anhøj <jacob@anhoej.net> | 
| License: | GPL-3 | 
| Encoding: | UTF-8 | 
| LazyData: | true | 
| URL: | http://github.com/anhoej/cprr | 
| BugReports: | http://github.com/anhoej/cprr/issues | 
| RoxygenNote: | 6.1.1 | 
| Suggests: | testthat | 
| Depends: | R (≥ 3.1.0) | 
| NeedsCompilation: | no | 
| Packaged: | 2019-03-17 07:01:26 UTC; jacob | 
| Repository: | CRAN | 
| Date/Publication: | 2019-03-17 07:33:21 UTC | 
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'))
Date of birth
Description
Calculate dates of birth from CPR numbers.
Usage
dob(cpr)
Arguments
| cpr | Character vector of CPR numbers with or without hyphens. | 
Value
Vector of dates of birth.
Examples
  dob(c('1508631111', '1310762222'))
Gender
Description
Calculate genders from CPR numbers.
Usage
gender(cpr)
Arguments
| cpr | Character vector of CPR numbers with or without hyphens. | 
Value
Integer vector of genders: 0 = female, 1 = male.
Examples
  gender(c('1508631111', '1310762222'))
Modulo 11 check
Description
Check if CPR numbers conform to modulo 11 check. Note, modulo 11 check was deprecated in 2007.
Usage
mod11(cpr)
Arguments
| cpr | Character vector of CPR numbers with or without hyphens. | 
Value
Logical vector of check results, NA if CPR number includes characters (temporary CPR number).
Examples
  mod11(c('1508631111', '1310762222', '2110625629'))
Scramble
Description
Make "anonymous" random numbers from CPR numbers.
Usage
scramble(cpr)
Arguments
| cpr | Character vector of CPR numbers with or without hyphens. | 
Value
Integer vector. Each integer represents one unique CPR number.
Examples
  scramble(c('1508631111', '1310762222', '1508631111'))
CPR numbers for testing.
Description
A dataset containing the list of CPR numbers used for testing calculation of date of birth and gender.
Usage
test_cpr
Format
A data frame with 30 rows and 3 columns.
- cpr
- CPR number 
- dob
- Date of birth 
- gender
- Gender, 0 = female, 1 = male 
...
Source
http://medcom.dk/opslag/koder-tabeller-ydere/tabeller/nationale-test-cpr-numre