as.pin: Parse personal identity numbers to ABS format

Description Usage Arguments Details Value References Examples

View source: R/pin.R

Description

as.pin Converts personal identity numbers of different formats to standard (ABS) pin format YYYYMMDDNNNC where YYYYMMDD is the date of birth, NNN is the birth number and C is the control number. is.pin checks wether an R object is of class "pin".

Usage

1
2
3
as.pin(pin)

is.pin(pin)

Arguments

pin

Vector with swedish personal identity numbers in character or numeric format. See details.

Details

as.pin converts different formats of swedish personal identity numbers to the standard ABS format. The formats that can be converted are:

(where "C" can be substituted by characters "A", "T" or "X" if "YYYY" < 1967).

Value

as.pin returns a vector of class "pin" (with additional classes "AsIs" and character) with swedish personal identity numbers with standard ABS format "YYYYMMDDNNNC". is.pin returns TRUE if pin is of class "pin", otherwise FALSE.

References

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Examples taken from SKV 704 (see references)
ex_pin1 <- c("196408233234", "640823-3234", "19640823-3234")
as.pin(pin = ex_pin1)
ex_pin2 <- c("6408233234")
as.pin(ex_pin2)
ex_pin3 <- c(6408233234, 196408233234)
as.pin(ex_pin3)
ex_pin4 <-rep(c("20121209-0122", "201212090122", "121209-0122", "1212090122"),250)
as.pin(ex_pin4)
ex_pin5 <-c("205012090122", "186512090122", "121209-0122", "121209-012A")
as.pin(pin = ex_pin5)
pin <-c("201212090122", "201212090122", "121209-0122", "1212090122")

sweidnumbr documentation built on March 31, 2020, 5:24 p.m.