R/utils.R

Defines functions with_seed_null

with_seed_null <- function(seed, code) {
  if (is.null(seed)) {
    code
  } else {
    withr::with_seed(seed, code)
  }
}

"%||%" <- function(a, b) {
  if (!is.null(a)) a else b
}

Try the vayr package in your browser

Any scripts or data that you put into this service are public.

vayr documentation built on April 16, 2025, 1:11 a.m.