R/utils-pipe.R

Defines functions `%||%`

# Taken from rlang
#' Default value for `NULL`
#'
#' This infix function makes it easy to replace `NULL`s with a default
#' value. It's inspired by the way that Ruby's or operation (`||`)
#' works.
#'
#' @param x,y If `x` is NULL, will return `y`; otherwise returns `x`.
#' @name op-null-default
#' @return A vector of `x` or `y`
`%||%` <- function(x, y) {
  if (is.null(x)) y else x
}
muschellij2/distribglm documentation built on April 17, 2021, 2:32 p.m.