R/utils.R

Defines functions is.empty

`%||%` <- function (x, y)
{
  if (is.empty(x))
    return(y)
  else if (is.null(x) || is.na(x))
    return(y)
  else if (class(x) == "character" && nchar(x) == 0)
    return(y)
  else x
}

is.empty <- function (x){
  !as.logical(length(x))
}
jpmarindiaz/shi18ny documentation built on July 2, 2017, 12:59 p.m.