Description Usage Arguments Value Note See Also Examples
View source: R/is-empty-character.R
Checks for empty or missing strings.
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | assert_all_are_empty_character(x, severity = getOption("assertive.severity",
"stop"))
assert_any_are_empty_character(x, severity = getOption("assertive.severity",
"stop"))
assert_all_are_non_empty_character(x,
severity = getOption("assertive.severity", "stop"))
assert_any_are_non_empty_character(x,
severity = getOption("assertive.severity", "stop"))
assert_all_are_missing_or_empty_character(x,
severity = getOption("assertive.severity", "stop"))
assert_any_are_missing_or_empty_character(x,
severity = getOption("assertive.severity", "stop"))
assert_all_are_non_missing_nor_empty_character(x,
severity = getOption("assertive.severity", "stop"))
assert_any_are_non_missing_nor_empty_character(x,
severity = getOption("assertive.severity", "stop"))
assert_all_strings_are_not_missing_nor_empty(x,
severity = getOption("assertive.severity", "stop"))
assert_any_strings_are_not_missing_nor_empty(x,
severity = getOption("assertive.severity", "stop"))
assert_is_an_empty_string(x, severity = getOption("assertive.severity",
"stop"))
assert_is_a_non_empty_string(x, severity = getOption("assertive.severity",
"stop"))
assert_is_a_missing_or_empty_string(x,
severity = getOption("assertive.severity", "stop"))
assert_is_a_non_missing_nor_empty_string(x,
severity = getOption("assertive.severity", "stop"))
is_empty_character(x, .xname = get_name_in_parent(x))
is_non_empty_character(x, .xname = get_name_in_parent(x))
is_missing_or_empty_character(x, .xname = get_name_in_parent(x))
is_non_missing_nor_empty_character(x, .xname = get_name_in_parent(x))
is_not_missing_nor_empty_character(x)
is_an_empty_string(x, .xname = get_name_in_parent(x))
is_a_non_empty_string(x, .xname = get_name_in_parent(x))
is_a_missing_or_empty_string(x, .xname = get_name_in_parent(x))
is_a_non_missing_nor_empty_string(x, .xname = get_name_in_parent(x))
|
x |
A character vector. |
severity |
How severe should the consequences of the assertion be?
Either |
.xname |
Not intended to be used directly. |
The is_*
functions return logical vectors for strings which
are (non) empty or missing, and the assert_*
functions throw errors
on failure.
In R, NA_character_
is considered to be a non-empty string
(at least by nzchar
), which is why many functions are
needed to to clarify the situation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # These functions return a vector:
x <- c("", "a", NA)
is_empty_character(x)
is_non_empty_character(x)
is_missing_or_empty_character(x)
is_non_missing_nor_empty_character(x)
# These functions return a single value:
is_an_empty_string("")
is_an_empty_string("a")
is_an_empty_string(NA_character_)
is_a_non_empty_string("")
is_a_non_empty_string("a")
is_a_non_empty_string(NA_character_)
is_a_missing_or_empty_string("")
is_a_missing_or_empty_string("a")
is_a_missing_or_empty_string(NA_character_)
is_a_non_missing_nor_empty_string("")
is_a_non_missing_nor_empty_string("a")
is_a_non_missing_nor_empty_string(NA_character_)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.