get_isbn_10_check_digit {libbib} | R Documentation |
Get ISBN 10 check digit
Description
Takes a string representation of an ISBN 10 and returns the check digit that satisfies the necessary condition. It can take a 10 digit string (and ignore the already extant check digit) or a 9 digit string (without the last digit)
Usage
get_isbn_10_check_digit(x, allow.hyphens = FALSE, errors.as.nas = FALSE)
Arguments
x |
A string of 9 or 10 digits |
allow.hyphens |
A logical indicating whether the hyphen
separator should be allowed
(default is |
errors.as.nas |
return NA if error instead of throwing error
(default is |
Value
Returns the character check digit that satifies the mod 11 condition. Returns "X" if 10. Returns NA if input is NA
Examples
get_isbn_10_check_digit("012491540X")
get_isbn_10_check_digit("0-124-91540-X", allow.hyphens=TRUE)
# nine digit string
get_isbn_10_check_digit("900403781")
get_isbn_10_check_digit("onetwothre", errors.as.nas=TRUE) # NA
# vectorized
get_isbn_10_check_digit(c("012491540X", "9004037810", "900403781"))
[Package libbib version 1.6.4 Index]