Description Usage Arguments Value Examples
Checks that the input contains ISBN-10 or ISBN-13 book codes.
1 2 3 4 5 6 7 8 9 10 11 | assert_all_are_isbn_codes(x, type = c("10", "13"), na_ignore = FALSE,
severity = getOption("assertive.severity", "stop"))
assert_any_are_isbn_codes(x, type = c("10", "13"), na_ignore = FALSE,
severity = getOption("assertive.severity", "stop"))
is_isbn10_code(x, .xname = get_name_in_parent(x))
is_isbn13_code(x, .xname = get_name_in_parent(x))
is_isbn_code(x, type = c("10", "13"))
|
x |
Input to check. |
type |
Either "isbn10", "isbn13" or both (for matching either type). |
na_ignore |
A logical value. If |
severity |
How severe should the consequences of the assertion be?
Either |
.xname |
Not intended to be called directly. |
A logical vector that is TRUE
when the input contains valid
ISBN book codes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | x10 <- c(
hyphens = "0-387-98503-4",
spaces = "0 387 98503 4",
just_numbers = "0387985034",
too_long = "00-387-98503-4",
too_short = "0-387-9850-4",
non_numeric = "Z-387-98503-4",
invalid_check_digit = "0-387-98503-5",
missing = NA
)
x13 <- c(
hyphens = "978-0-387-98503-9",
spaces = "978 0 387 98503 9",
just_numbers = "9780387985039",
too_long = "9978-0-387-98503-9",
too_short = "978-0-387-9850-9",
non_numeric = "Z78-0-387-9850-9",
invalid_check_digit = "978-0-387-98503-8",
missing = NA
)
is_isbn_code(x10, type = "10")
assert_any_are_isbn_codes(x10, type = "10")
is_isbn_code(x13, type = "13")
assert_any_are_isbn_codes(x13, type = "13")
# These checks should fail.
assertive.base::dont_stop(assert_all_are_isbn_codes(x10, type = "10"))
assertive.base::dont_stop(assert_all_are_isbn_codes(x13, type = "13"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.