R/utils.R

Defines functions commas level extract_level_names `%||%`

`%||%` <- function(x, y) {
  if (is.null(x)) {
    y
  } else {
    x
  }
}

extract_level_names <- function(data, prefix) {
  pattern <- paste0(prefix, level(), collapse = "|")
  columns <- select(data, tidyselect::matches(pattern))
  names(columns)
}

level <- function() {
  c("direct", "intermediate", "ultimate")
}

commas <- function(...) paste0(..., collapse = ", ")

Try the r2dii.match package in your browser

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

r2dii.match documentation built on June 22, 2024, 9:38 a.m.