Skip to contents

[Experimental]

*_empty() check if an argument has zero length.

Usage

check_empty(x, null_ok = FALSE, .names = deparse(substitute(x)))

test_empty(x, null_ok = FALSE, .names = deparse(substitute(x)))

assert_empty(x, null_ok = FALSE, .names = deparse(substitute(x)))

Arguments

x

Any R object.

null_ok

(Optional) A logical flag indicating if NULL values are allowed (Default: FALSE).

.names

(Optional) A character vector specifying the names of the objects being tested. This argument is used internally and should not be set by the user.

Examples

test_empty(1)
#> [1] FALSE
#> [1] FALSE # Expected

test_empty(character())
#> [1] TRUE
#> [1] TRUE # Expected