get_isbn_13_check_digit {libbib}R Documentation

Get ISBN 13 check digit

Description

Takes a string representation of an ISBN 13 and returns the check digit that satisfies the necessary condition. It can take a 13 digit string (and ignore the already extant check digit) or a 12 digit string (without the last digit)

Usage

get_isbn_13_check_digit(x, allow.hyphens = FALSE, errors.as.nas = FALSE)

Arguments

x

A string of 12 or 13 digits

allow.hyphens

A logical indicating whether the hyphen separator should be allowed (default is FALSE)

errors.as.nas

return NA if error instead of throwing error (default is FALSE)

Value

Returns the character check digit that satifies the mod 10 condition. Returns NA if input is NA

Examples


get_isbn_13_check_digit("9780306406157")

# 12 digit string
get_isbn_13_check_digit("978030640615")

get_isbn_13_check_digit("onetwothreefo", errors.as.nas=TRUE)  # NA

# vectorized
get_isbn_13_check_digit(c("9780306406157", "9783161484100"))


[Package libbib version 1.6.4 Index]