-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
80 lines (61 loc) · 2.42 KB
/
README.Rmd
File metadata and controls
80 lines (61 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# rocnp
<!-- badges: start -->
[](https://github.com/dragosmg/rocnp/actions/workflows/R-CMD-check.yaml)
[](https://app.codecov.io/gh/dragosmg/rocnp)
[](https://lifecycle.r-lib.org/articles/stages.html#stable)
[](https://CRAN.R-project.org/package=rocnp)
<!-- badges: end -->
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):
* an S3 class called `cnp`:
* implemented as a record (similar to `POSIXlt`) with `vctrs::new_rcrd()`. The implementation details are
* a constructor, `cnp()` for creating a `cnp` object
* the constructor automatically decomposes the CNP and augments it by parsing the various field
* access the various components with the `extract_()` family of functions:
* use `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.
## Installation
You can install the released version of {rocnp} from [CRAN](https://CRAN.R-project.org):
``` r
install.packages("rocnp")
```
Alternatively, if you need the development version from [GitHub](https://github.com/dragosmg/rocnp), install it with
``` r
# install.packages("pak")
pak::pkg_install("dragosmg/rocnp")
```
## Usage
This is an example which shows you how to use some of the functions in rocnp:
```{r example}
library(rocnp)
# these are synthetically generated CNPs
# check CNP is valid
cnps <- cnp(
c(
"1940616346114", "6201206018078", "1940616346114"
)
)
extract_sex(cnps)
extract_birth_year(cnps)
extract_birth_month(cnps)
extract_dob(cnps)
extract_county(cnps)
extract_status(cnps)
```