rocnp

The goal of {rocnp} is to provide a set of functions for working with Romanian Personal Numeric Codes / Coduri Numerice Personale (CNP).

Features

rocnp includes the following functionality for working with Romanian personal numeric codes (PNC / CNP):

Installation

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'))

Usage

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"