R/helpers.R

Defines functions `%||%` str_collapse

str_collapse <- function(str) {
  sprintf("{%s}", paste0(str, collapse = ", "))
}

# With thanks to rlang
`%||%` <- function(x, y) {
  if (is.null(x)) {
    y
  } else {
    x
  }
}

Try the ooplah package in your browser

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

ooplah documentation built on Jan. 21, 2022, 5:07 p.m.