assertive.strings (version 0.0-3)

assert_all_are_empty_character: Does the input contain empty or missing strings?

Description

Checks for empty or missing strings.

Usage

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))

Arguments

x
A character vector.
severity
How severe should the consequences of the assertion be? Either "stop", "warning", "message", or "none".
.xname
Not intended to be used directly.

Value

The is_* functions return logical vectors for strings which are (non) empty or missing, and the assert_* functions throw errors on failure.

See Also

is_character, nzchar

Examples

Run this code
# 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_)

Run the code above in your browser using DataLab