Is a character variable defined

is_empty(x, empty = "\\s*")

Arguments

x

Character value to evaluate

empty

Indicate what 'empty' means. Default is empty string (i.e., "")

Value

TRUE if empty, else FALSE

Details

Is a variable NULL or an empty string

Examples

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