is_valid_issn: Return TRUE if valid ISSN

View source: R/bibcodes.R

is_valid_issnR Documentation

Return TRUE if valid ISSN

Description

Takes a string representation of an ISSN verifies that it is valid. An ISSN is valid if it is a 8 digit string or a 7 digit string with a terminal "X" AND the check digit matches

Usage

is_valid_issn(x, allow.hyphens = TRUE, lower.x.allowed = TRUE)

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)

lower.x.allowed

A logical indicating whether ISSNs with a check digit with a lower-case "x" should be treated as valid (default is TRUE)

Value

Returns TRUE if checks pass, FALSE if not, and NA if NA

Examples


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

# vectorized

is_valid_issn(c("2434-561X", "2434-5611", "0378-5955", NA))
# TRUE FALSE TRUE NA


libbib documentation built on Nov. 10, 2022, 6:16 p.m.