R/is_empty.R

Defines functions is_empty is_empty.default is_empty.data.frame

#' Is an Object empty?
#'
#' for data.frames `is_empty()` returns true if it has either zero rows or
#' zero columns.
#'
#' @param x any R object
#'
#' @return logical. `TRUE` if `x` is emtpy. 
#' @export
is_empty <- function(x){
  UseMethod("is_empty")
} 
 



#' @export
is_empty.default <- function(x){
  identical(length(x), 0L)
}




#' @export
is_empty.data.frame <- function(x){
  identical(nrow(x), 0L) || identical(length(x), 0L)
}
s-fleck/isit documentation built on Aug. 20, 2019, 8:39 a.m.