Load and optionally install additional packages.

loadPackages(packageList, install = FALSE, quiet = TRUE)

# S4 method for character
loadPackages(packageList, install = FALSE,
  quiet = TRUE)

# S4 method for list
loadPackages(packageList, install = FALSE,
  quiet = TRUE)

# S4 method for `NULL`
loadPackages(packageList, install = FALSE,
  quiet = TRUE)

Arguments

packageList

A list of character strings specifying the names of packages to be loaded.

install

Logical flag. If required packages are not already installed, should they be installed?

quiet

Logical flag. Should the final "packages loaded" message be suppressed?

Value

Specified packages are loaded and attached using require(), invisibly returning a logical vector of successes.

See also

require.

Examples

# NOT RUN {
  pkgs <- list("raster", "lme4")
  loadPackages(pkgs) # loads packages if installed
  loadPackages(pkgs, install = TRUE) # loads packages after installation (if needed)
# }