Learn R Programming

SpaDES (version 1.3.1)

loadPackages: Load packages.

Description

Load and optionally install additional packages.

Usage

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

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

Run the code above in your browser using DataLab