This function allows you to install packages.

install_if_needed(pkgs, lib = NULL, repos = getOption("repos"),
  contriburl = contrib.url(repos, type), method, available = NULL,
  destdir = NULL, dependencies = NA, type = getOption("pkgType"),
  configure.args = getOption("configure.args"),
  configure.vars = getOption("configure.vars"), clean = FALSE,
  Ncpus = getOption("Ncpus", 1L), verbose = getOption("verbose"),
  libs_only = FALSE, INSTALL_opts, quiet = FALSE, keep_outputs = FALSE,
  check_version = TRUE, ...)

Examples

install_if_needed("dplyr")
#> Warning: Skipping dplyr