Description Usage Arguments Value Note Examples
Checks that the input contains hexadecimal colors.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | assert_all_are_hex_colors(x, na_ignore = FALSE,
severity = getOption("assertive.severity", "stop"))
assert_any_are_hex_colors(x, na_ignore = FALSE,
severity = getOption("assertive.severity", "stop"))
assert_all_are_hex_colours(x, na_ignore = FALSE,
severity = getOption("assertive.severity", "stop"))
assert_any_are_hex_colours(x, na_ignore = FALSE,
severity = getOption("assertive.severity", "stop"))
is_hex_color(x)
is_hex_colour(x)
|
x |
Input to check. |
na_ignore |
A logical value. If |
severity |
How severe should the consequences of the assertion be?
Either |
A logical vector that is TRUE
when the input contains hex
colours.
A string is considered to represent a hexadecimal colour when contains a hash followed by six hex values. That is, digits or the letters from a to f (case insensitive).
1 2 3 4 5 6 7 8 9 10 11 | x <- c(
"#012345", "#789abc", "#defDEF", #ok
"012345", #no hash
"#g12345", #bad letter
"#01 23 45", #contains spaces
"#12345", "#1234567" #wrong length
)
is_hex_color(x)
assert_any_are_hex_colors(x)
#These examples should fail.
assertive.base::dont_stop(assert_all_are_hex_colors(x))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.