Title: | Italian Fiscal Code ('Codice Fiscale') Utilities |
---|---|
Description: | Provides utility functions to deal with Italian fiscal code ('codice fiscale'). |
Authors: | Luca Braglia [aut, cre] |
Maintainer: | Luca Braglia <[email protected]> |
License: | GPL-3 |
Version: | 0.3.6 |
Built: | 2024-11-07 03:10:51 UTC |
Source: | https://github.com/lbraglia/ifctools |
The function tries to guess regular fiscal code, extracting relevant alphanumeric digits from surname, name, birth date, gender and 'codice catastale' (computing the last character, the control digit).
guess_fc( surname = NULL, name = NULL, birth_date = NULL, female = NULL, codice_catastale = NULL )
guess_fc( surname = NULL, name = NULL, birth_date = NULL, female = NULL, codice_catastale = NULL )
surname |
character, surname |
name |
character, names |
birth_date |
Date, date of birth |
female |
logical, female indicator variable ( |
codice_catastale |
Italian 'codice catastale' (an identifier) of the 'comune' of birth |
The function return a character vector of fiscal code.
## using fictious data Surnames <- c("Rossi", "Bianchi") Names <- c("Mario", "Giovanna") Birthdates <- as.Date(c("1960-01-01", "1970-01-01")) Female <- c(FALSE, TRUE) Comune_of_birth <- c("F205", # milan "H501") # rome guess_fc(Surnames, Names, Birthdates, Female, Comune_of_birth)
## using fictious data Surnames <- c("Rossi", "Bianchi") Names <- c("Mario", "Giovanna") Birthdates <- as.Date(c("1960-01-01", "1970-01-01")) Female <- c(FALSE, TRUE) Comune_of_birth <- c("F205", # milan "H501") # rome guess_fc(Surnames, Names, Birthdates, Female, Comune_of_birth)
The function performs fiscal codes check (both regular and temporary ones), computing the last (control) character basing on the others. The algorithm is intended to be quite "draconian", so you'll better make some pre-cleaning (keep only alphabetic characters and uppercase) if needed. See examples.
wrong_fc(fc)
wrong_fc(fc)
fc |
A character vector of fiscal codes. |
The function return TRUE
if the fiscal code is wrong,
FALSE
otherwise.
Law source: D.M. (Ministry of Finance) n. 13813 - 23/12/76 - "Sistemi di codificazione dei soggetti da iscrivere all'anagrafe tributaria". Supp. ord. G.U. 345 29/12/1976.
fc <- c(NA, "qWeASd34D12h 221M ", " 12312312312 ") wrong_fc(fc) fc <- gsub(" ","", toupper(fc)) wrong_fc(fc)
fc <- c(NA, "qWeASd34D12h 221M ", " 12312312312 ") wrong_fc(fc) fc <- gsub(" ","", toupper(fc)) wrong_fc(fc)