is_empty | R Documentation |
Logical test for all the different versions of empty values, i.e.:
NULL
""
NA
"\\n
"
list()
length(x)==0
is_empty(x, names_meaningful = FALSE)
x |
any value or vector |
names_meaningful |
logical, if T, when an empty data frame or list is supplied for x that is all NA, but has names, it will return FALSE. default= FALSE |
Works on values, vectors, or a flat list. For vector and list inputs output will be a single T or F, not a vector of T/F values.
TRUE (if empty) or FALSE (if not empty)
logical T=Empty, F=Not empty
is_empty("")
is_empty(3)
is_empty(c("",NA,NULL))
is_empty(list(a="",b=NA,c=NULL))
is_empty(list(a="",b=NA,c="nonempty cell"))
b <- dplyr::tibble(ImportantColumn=NA,ImportantColumn2=NA)
is_empty(b)
#Here, if we care about column names and don't consider this
#empty, we should return FALSE
is_empty(b, names_meaningful=TRUE)
is_empty(list(a=NA,b=b,c=list(),d=NULL))
is_empty(list(a=NA,b=b,c=list(),d=NULL), names_meaningful=TRUE)
is_empty(data.frame(a=NA,b=NA))
#
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.