letraNIFE: Returns the final letter of a DNI or NIE 8 characters string.

Description Usage Arguments Value Examples

Description

The function implements the algorithm described in http://www.interior.gob.es/web/servicios-al-ciudadano/dni/calculo-del-digito-de-control-del-nif-nie to derive the final letter of a 8 characters. The first character in the string may be either a number or "X", "Y" or "Z". The remaining 7 characters must be digits. If dni does not match this format, the function returns NA.

Usage

1
letraNIFE(dni)

Arguments

dni

String vector.

Value

the final letter of the DNI / NIE. The function is vectorized, so that it admits a vector of strings and returns a vector. If dni does not match the right format for a DNI or NIE, it returns NA.

Examples

1
letraNIFE(c("12345678", "1234", "A1234567", "Y1234567", "X1234567"))

mkesslerct/opadar documentation built on May 23, 2019, 2:01 a.m.