The goal of {rocnp} is to provide a set of functions for working with Romanian Personal Numeric Codes / Coduri Numerice Personale (CNP).
rocnp includes the following functionality for working with Romanian personal numeric codes (PNC / CNP):
cnp:
POSIXlt) with
vctrs::new_rcrd(). The implementation details arecnp() for creating a cnp objectextract_() family of
functions:
extract_sex() for sex.extract_birth_year() for the year of birth.extract_birth_month() for the month of birth.extract_county() for county of issue.extract_status() for the residence status.extract_dob() for the date of birth.You can install the released version of {rocnp} from CRAN:
install.packages("rocnp")
Alternatively, if you need the development version from GitHub, install it with
# install.packages("pak")
# pak::pkg_install("dragosmg/rocnp")
install.packages("rocnp", repos = c('https://dragosmg.r-universe.dev', 'https://cloud.r-project.org'))
This is an example which shows you how to use some of the functions in rocnp:
library(rocnp)
# these are synthetically generated CNPs
# check CNP is valid
cnps <- cnp(
c(
"1940616346114", "6201206018078", "1940616346114"
)
)
extract_sex(cnps)
#> [1] "M" "F" "M"
extract_birth_year(cnps)
#> [1] "1994" "2020" "1994"
extract_birth_month(cnps)
#> [1] "06" "12" "06"
extract_dob(cnps)
#> [1] "1994-06-16" "2020-12-06" "1994-06-16"
extract_county(cnps)
#> [1] "Teleorman" "Alba" "Teleorman"
extract_status(cnps)
#> [1] "native" "native" "native"