R/utils.R

Defines functions check_installed

check_installed <- function(pkgs) {
  inst <- vapply(pkgs, requireNamespace, quietly = TRUE, FUN.VALUE = logical(1))
  if (all(inst)) {
    return(TRUE)
  }
  stop("Must install the following packages to use this function:\n",
       paste0("* ", pkgs[!inst], "\n"), call. = FALSE)
}
jdtrat/tokencodr documentation built on Dec. 20, 2021, 10:06 p.m.