fc.check: Check fiscal codes

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/fc.check.R

Description

The function performs fiscal codes (both temporary and definitive) check, computing the last (control) character basing on the others. The algorithm is intended to be quite "draconian", so you'll better make some precleaning (remove blank spaces and upcase) if needed. See examples.

Usage

1

Arguments

fc

A character vector of fiscal codes.

Value

The function return TRUE if the fiscal code is wrong, FALSE otherwise.

Author(s)

Luca Braglia <lbraglia@gmail.com>

References

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.

See Also

ifctools

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## As i've said, the algo is quite draconian. Consider the code
## "QWEASD34D12H221M" (fictitious but right). I would like
## "qWeASd34D12h 221M   " to be (and it's) TRUE, because i consider it
## as an error (it's diminishing match probability).

fc.check("qWeASd34D12h 221M   ") 

## So you'll betted do pre-cleaning (upcase and blank trimming)

fc <- c("qWeASd34D12h 221M   ", "12312312312")
fc <- gsub(" ","", toupper(fc))
fc.check(fc)

## Check results with (i.e.)
## http://www.nonsolocap.it/codice-fiscale/controllo/  

ifctools documentation built on May 2, 2019, 5:18 p.m.