normalize_isbn {libbib}R Documentation

Attempt to enforce validity and canonical form to an ISBN

Description

Takes a string representation of an ISBN (10 or 13). This function uses tries to normalize the string as a ISBN 13, then an ISBN 10. If one of those methods are able to salvage the ISBN, the canonicalized ISBN is returned. User can specify whether "aggressive" measures should be taken to salvage the malformed ISBN string.

Usage

normalize_isbn(x, aggressive = TRUE, convert.to.isbn.13 = FALSE)

Arguments

x

A string

aggressive

A logical indicating whether aggressive measures should be taken to try to get the "ISBN 10" into a valid form. See "Details" for more info (default is TRUE)

convert.to.isbn.13

A logical indicating whether the ISBN 10 should be converted into an ISBN 13 (default is FALSE)

Details

If aggressive is TRUE, aggressive measures are taken to try to salvage the malformed ISBN string. Since this function attempts to salvage both an ISBN 10 and 13, to learn about examples of the aggressive methods, see normalize_isbn_10 and normalize_isbn_13

Value

Returns valid ISBN if possible, NA if not

See Also

normalize_isbn_10 normalize_isbn_13

Examples


normalize_isbn("012491540x")                           # "012491540X"
normalize_isbn("012491540x", convert.to.isbn.13=TRUE)
"9780124915404"

# vectorized
normalize_isbn(c("513213012491540x245",
                 "978966819^*!X7918",
                 NA,
                 "97815724115799781572411579"))
# "012491540X", "9789668197918", NA, "9781572411579"


[Package libbib version 1.6.4 Index]