Is a character variable defined
is_empty(x, empty = "\\s*")Character value to evaluate
Indicate what 'empty' means. Default is empty string (i.e., "")
TRUE if empty, else FALSE
Is a variable NULL or an empty string
is_empty("")
#> [1] TRUE
is_empty(NULL)
#> [1] TRUE
is_empty(NA)
#> [1] TRUE
is_empty(c())
#> [1] TRUE
is_empty("none", empty = "none")
#> [1] TRUE
is_empty("")
#> [1] TRUE
is_empty(" ")
#> [1] TRUE
is_empty(" something ")
#> [1] FALSE
is_empty(c("", "something"))
#> [1] FALSE
is_empty(c(NA, 1:100))
#> [1] FALSE
is_empty(mtcars)
#> [1] FALSE