R/if-else-expr.R

Defines functions if_else_expr

if_else_expr <- function(condition,  true, false) {
  if (!is.logical(condition))
    stop("'condition' must be a logical value.")
  if (length(condition) != 1)
    stop("'condition' must be length 1.")

  if (condition) {
    out <- true
  } else {
    out <- false
  }
  out
}
wcmbishop/gogoplot documentation built on May 29, 2019, 10:39 a.m.