R/zzz.R

Defines functions wsn assert ct

ct <- function(l) Filter(Negate(is.null), l)

assert <- function(x, y) {
  if (!is.null(x)) {
    if (!inherits(x, y)) {
      stop(deparse(substitute(x)), " must be of class ",
        paste0(y, collapse = ", "), call. = FALSE)
    }
  }
}

wsn <- function(n = 1) {
  paste0(replicate(n = n, ""), collapse = " ")
}
sckott/astr documentation built on Nov. 12, 2024, 4:19 p.m.