assert_all_are_empty_character {assertive.strings} | R Documentation |
Checks for empty or missing strings.
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.
# 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_)