Skip to contents

verhoeff_valid() checks whether a number (including its final check digit) passes the Verhoeff checksum. verhoeff_check_digit() computes the check digit to append to a number.

Usage

verhoeff_valid(x)

verhoeff_check_digit(x)

Arguments

x

A character vector of digit strings. Spaces and hyphens are ignored.

Value

verhoeff_valid(): a logical vector (FALSE for anything that is not all digits). verhoeff_check_digit(): a character vector of single digits (NA for invalid input).

Examples

verhoeff_check_digit("236")
#> [1] "3"
verhoeff_valid("2363")
#> [1] TRUE