Learn R Programming

hetu (version 1.0.1)

pin_age: Age from ID

Description

Calculate the age in full years for a given date.

Usage

pin_age(pin, date = Sys.Date(), timespan = "years", allow.temp = FALSE)

hetu_age(pin, date = Sys.Date(), timespan = "years", allow.temp = FALSE)

Arguments

pin

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

date

Date at which age is calculated. If a vector is provided it must be of the same length as the pin argument.

timespan

Timespan to use to calculate age. The actual timespans are:

  • years (Default)

  • months

  • weeks

  • days

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.

Value

Age as an integer vector.

Examples

Run this code
# NOT RUN {
ex_pin <- c("010101-0101", "111111-111C")
pin_age(ex_pin, date = "2012-01-01")

ex_pin <- c("010101-0101", "111111-111C")
hetu_age(ex_pin, date = "2012-01-01")
# }

Run the code above in your browser using DataLab