R/utils.R

Defines functions protect_zero_length replace_waiver

replace_waiver <- function(x, y) {
  if (inherits(x, "waiver")) {
    return(y)
  } else {
    return(x)
  }
}

protect_zero_length <- function(x, alt = NULL) {
  if (length(x) == 0) {
    return(alt)
  } else {
    return(x)
  }
}
teunbrand/ggplateplot documentation built on May 8, 2022, 1:06 a.m.