Learn R Programming

hetu (version 1.0.1)

hetu: Finnish personal identification number extraction

Description

Extract information from Finnish personal identification numbers (hetu).

Usage

hetu(pin, extract = NULL, allow.temp = FALSE, diagnostic = FALSE)

Arguments

pin

Finnish personal identification number as a character vector, or vector of identification numbers as a character vectors

extract

Extract only selected part of the information. Valid values are "hetu", "sex", "p.num", "checksum", "date", "day", "month", "year", "century", "is.temp". If NULL (default), returns all information.

allow.temp

Allow artificial or temporary PINs (personal numbers 900-999). If FALSE (default), only PINs intended for official use (personal numbers 002-899) are allowed.

diagnostic

Print additional information about possible problems in PINs. The checks are "invalid.p.num", "invalid.checksum", "incorrect.checksum" "invalid.date", "invalid.day", "invalid.month, "invalid.length, "invalid.century". Default is FALSE which returns no diagnostic information.

Value

Finnish personal identification number data.frame, or if extract parameter is set, the requested part of the information as a vector. Returns an error or NA if the given character vector is not a valid Finnish personal identification number.

hetu

Finnish personal identification number as a character vector. A correct pin should be in the form DDMMYYCZZZQ, where DDMMYY stands for date, C for century sign, ZZZ for personal number and Q for checksum character.

sex

sex of the person as a character vector ("Male" or "Female").

p.num

Personal number part of the identification number.

checksum

Checksum for the personal identification number.

date

Birthdate.

day

Day of the birthdate.

month

Month of the birthdate.

year

Year of the birthdate.

century

Century character of the birthdate: + (1800), - (1900) or A (2000).

is.temp

Is the personal identification number an artificial number intended for temporary use: (TRUE or FALSE)

See Also

pin_ctrl For validating Finnish personal identification numbers.

Examples

Run this code
# NOT RUN {
hetu("111111-111C")
hetu("111111-111C")$date
hetu("111111-111C")$sex
# Same as previous, but using extract argument
hetu("111111-111C", extract="sex")

# Process a vector of hetu's
hetu(c("010101-0101", "111111-111C"))

# Process a vector of hetu's and extract sex information from each
hetu(c("010101-0101", "111111-111C"), extract="sex")
# }

Run the code above in your browser using DataLab