R/require.R

Defines functions uses

Documented in uses

#' Checks that package can be used, else returns error
#'
#' @param packages character vector: packages required
#' @param error error function
#' @param message error message
#'
#' @keywords internal
#'
#' @examples \dontrun{
#' uses("stringr", stop, "Prerequisite not available")
#' }
uses <- function(packages, error, message) {
  for (package in packages)
    if (!requireNamespace(package, quietly = TRUE))
      error(message)
}
AhmedMehdiLab/E.PAGE documentation built on Aug. 21, 2022, 4:37 p.m.