Does the input contain empty or missing strings?

Share:

Description

Checks for empty or missing strings.

Usage

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

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.

Note

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.

See Also

is_character, nzchar

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23