R/utils.R

Defines functions `%||%` compact

## Defaults for NULL values
`%||%` <- function(a, b) if (is.null(a)) b else a

## Remove NULLs from a list
compact <- function(x) {
  x[!vapply(x, is.null, logical(1))]
}
percyfal/nonmodelr documentation built on Sept. 11, 2019, 10:38 a.m.