valid_check_digit: Check for Valid VIN Check Digit
Description
Calculates the VIN check digit and compares it to VIN position 9.
For US-based VINs, this determines if the VIN is valid.
This may not apply to VINs from outside of the United States.
Usage
valid_check_digit(vin, value = FALSE, guess = FALSE)
Arguments
vin
character. The VIN to check. VINs must be compete, i.e. 17 digits
with no wildcards.
value
logical. Should the calculated check digit be returned instead?
guess
logical. Should incorrect characters be replaced by the best
guess at corrected characters?
O -> 0
I -> 1
Q -> 0
Value
If value is FALSE, a logical value is returned.
If value is TRUE, a character is returned.
# NOT RUN {valid_check_digit("WDBEA30D3HA391172") # Truevalid_check_digit("WDBEA30D3HA391172", value = TRUE)
valid_check_digit("WDBEA3QD3HA39I172", guess = TRUE)
# }