R/install_pkg.R

Defines functions is_installed

is_installed <- function(..., .stop = FALSE) {
  x <- c(...)
  ip <- utils::installed.packages()
  yn <- x %in% ip
  if (sum(!yn) > 0 && .stop) {
    msg <- pmsg(
      "This function requires the following packages: ",
      paste(x[!yn], collapse = ", "),
      print = FALSE
    )
    stop(msg, call. = FALSE)
  }
  invisible(set_names(yn, x))
}

Try the tfse package in your browser

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

tfse documentation built on May 2, 2019, 11:28 a.m.