Learn R Programming

libbib (version 1.6.4)

check_issn_check_digit: Check the check digit of an ISSN

Description

Takes a string representation of an ISSN and verifies that check digit checks out

Usage

check_issn_check_digit(x, allow.hyphens = TRUE, errors.as.false = FALSE)

Value

Returns TRUE if check passes, FALSE if not, and NA if NA

Arguments

x

A string of 8 digits or 7 digits with terminal "X"

allow.hyphens

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

errors.as.false

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

Examples

Run this code

check_issn_check_digit("2434561X")   # TRUE
check_issn_check_digit("2434-561X")  # TRUE

# vectorized
check_issn_check_digit(c("03785955", "2434561X", NA))  # TRUE TRUE NA
check_issn_check_digit(c("0378-5955", "2434-561X", NA))
# TRUE TRUE NA

Run the code above in your browser using DataLab