Package 'ltcodes'

Title: Validate Lithuanian Personal, Company, VAT and Bank Account Codes
Description: Vectorised checks for Lithuanian personal codes, company codes, VAT numbers and IBANs, and helpers that read the birth date and sex stored in a personal code. The company code check was tested against the open data of the Register Centre <https://www.registrucentras.lt/p/1094>.
Authors: Justas Arbatauskis [aut, cre]
Maintainer: Justas Arbatauskis <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2026-11-27 17:53:22 UTC
Source: https://github.com/ello-lithuania/ltcodes

Help Index


Test Lithuanian company codes

Description

A company code has nine digits and ends in a check digit.

Usage

is_company_code(x)

Arguments

x

A character vector of codes.

Value

A logical vector of the same length as x; NA input gives NA.

Examples

is_company_code(c("123033512", "123033513"))

Test Lithuanian IBANs

Description

A Lithuanian IBAN has 20 characters, starts with LT and passes the MOD-97 rule.

Usage

is_iban(x)

Arguments

x

A character vector of account numbers.

Value

A logical vector of the same length as x; NA input gives NA.

Examples

is_iban(c("LT121000011101001000", "LT121000011101001001"))

Test Lithuanian personal codes

Description

A personal code has 11 digits: the first gives the century and sex, the next six the birth date, and the last is a check digit. Codes that start with 9 carry no date, so only the check digit is tested.

Usage

is_personal_code(x)

Arguments

x

A character vector of codes.

Value

A logical vector of the same length as x; NA input gives NA.

Examples

is_personal_code(c("33309240064", "33309240164"))

Test Lithuanian VAT numbers

Description

A VAT number has 9 or 12 digits and may start with LT.

Usage

is_vat_number(x)

Arguments

x

A character vector of numbers.

Value

A logical vector of the same length as x; NA input gives NA.

Examples

is_vat_number(c("LT119511515", "LT119511516"))

Read the birth date from Lithuanian personal codes

Description

Reads the date stored in the second to seventh digits. The check digit is not tested.

Usage

personal_code_birth_date(x)

Arguments

x

A character vector of personal codes.

Value

A Date vector of the same length as x, with NA where a code holds no valid date.

Examples

personal_code_birth_date("33309240064")

Read the sex from Lithuanian personal codes

Description

Reads the sex stored in the first digit.

Usage

personal_code_sex(x)

Arguments

x

A character vector of personal codes.

Value

A character vector with "M" for first digits 1, 3 and 5, "F" for 2, 4 and 6, and NA otherwise.

Examples

personal_code_sex("33309240064")