is_empty | R Documentation |
This function checks whether a string or character vector, a list or any vector (numeric, atomic) is empty or not.
is_empty(x, na_empty = TRUE)
x |
String, character vector, list, data.frame or numeric vector or factor. |
na_empty |
Logical, if |
Logical vector.
is_empty("test")
is_empty("")
is_empty(NA)
is_empty(NULL)
# string is not empty
is_empty(" ")
# however, this trimmed string is
is_empty(trimws(" "))
# numeric vector
x <- 1
is_empty(x)
x <- x[-1]
is_empty(x)
# check multiple elements of character vectors
is_empty(c("", "a"))
# empty data frame
d <- data.frame()
is_empty(d)
# empty list
# is_empty(list(NULL))
# NA vector
x <- rep(NA, 5)
is_empty(x)
is_empty(x, na_empty = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.