Validate and normalize identifiers that are ubiquitous in financial technology data pipelines: payment card numbers (Luhn), International Bank Account Numbers (IBAN, ISO 13616), International Securities Identification Numbers (ISIN, ISO 6166), CUSIP, SEDOL, Legal Entity Identifiers (LEI, ISO 17442), Financial Instrument Global Identifiers (FIGI), SWIFT/BIC codes (ISO 9362) and Chinese Unified Social Credit Codes (GB 32100-2015). All checks run offline with base R only.
Validation and normalization of financial identifiers for R.
finid checks identifiers offline, with no third-party dependencies, and
returns vectorized results that fit naturally into data-cleaning pipelines.
| Type | Function | Standard |
|---|---|---|
| Payment card numbers | pan_valid(), luhn_valid(), luhn_check_digit() |
Luhn |
| IBAN | iban_valid(), iban_format() |
ISO 13616 |
| ISIN | isin_valid(), isin_country(), isin_check_digit() |
ISO 6166 |
| CUSIP | cusip_valid(), cusip_check_digit() |
- |
| SEDOL | sedol_valid(), sedol_check_digit() |
- |
| LEI | lei_valid(), lei_check_digits() |
ISO 17442 |
| FIGI | figi_valid(), figi_check_digit() |
OMG FIGI |
| SWIFT/BIC | swift_valid(), swift_country() |
ISO 9362 |
| Unified Social Credit Code | uscc_valid(), uscc_check_digit() |
GB 32100-2015 |
# once released on CRAN
install.packages("finid")
# or from source
install.packages("finid_0.1.0.tar.gz", repos = NULL, type = "source")
library(finid)
finid_normalize("gb82 west 1234 5698 7654 32")
#> [1] "GB82WEST12345698765432"
finid_check(c(
"US0378331005",
"GB82WEST12345698765432",
"037833100",
"4532015112830366",
"not-an-id"
))
#> input normalized type valid
#> 1 US0378331005 US0378331005 isin TRUE
#> 2 GB82WEST12345698765432 GB82WEST12345698765432 iban TRUE
#> 3 037833100 037833100 cusip TRUE
#> 4 4532015112830366 4532015112830366 pan TRUE
#> 5 not-an-id NOT-AN-ID unknown FALSE
Identifiers can be supplied with spaces or hyphens; every validator normalizes its input first.
MIT (see LICENSE).