| as.pin | R Documentation |
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".
as.pin(pin)
is.pin(pin)
pin |
Vector with swedish personal identity numbers in character or numeric format. See details. |
as.pin converts different formats of swedish personal identity numbers to
the standard ABS format. The formats that can be converted are:
numeric: YYYYMMDDNNNC
numeric: YYMMDDNNNC (assuming < 100 years of age)
character: "YYYYMMDDNNNC"
character: "YYMMDD-NNNC", "YYMMDD+NNNC"
character: "YYYYMMDD-NNNC"
character: "YYMMDDNNNC" (assuming < 100 years of age)
(where "C" can be substituted by characters "A", "T" or "X" if "YYYY" < 1967).
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.
Skatteverket, Population registration in Sweden, SKV 717B (2007)
Personnummer: information fran Centrala folkbokförings- och uppbördsnämnden. (1967). Stockholm
Den svenska folkbokföringens historia under tre sekel. (1982). Solna: Riksskatteverket URL
# 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")
ex_pin <- rpin(3)
is.pin(ex_pin)
ex_pin_char <- as.character(ex_pin)
is.pin(ex_pin_char)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.