load_packages: Load and install packages

Description Usage Arguments Details Value See Also Examples

View source: R/package-loading.R

Description

Utility function to load and optionally install packages if they are missing. When the function terminates, packages are installed (if necessary) and loaded. Upgradeable packages are shown.

Usage

1
2
3
load_packages(..., install_packages = TRUE, force_install = FALSE,
  show_outdated_packages = FALSE, default_loading_method = FALSE,
  return_library_statements = FALSE)

Arguments

...

list of package names.

install_packages

whether to install the selected packages.

force_install

whether to install packages even if they are installed already.

show_outdated_packages

whether to show a list of packages which are outdated.

default_loading_method

load according to the default R method using only library()

return_library_statements

makes this function only return a string containing library() statements which can be paste into an R script.

Details

load_packages optionally installs, upgrades and attaches packages to the work space for a list of specified packages.

Value

Returns invisibly a list with additional package information and results of installing/upgrading and loading.

See Also

install.packages for installation of new packages, update.packages for updating outdated packages, library for load and attaching packages.

Other developer functions: crossref_description, generic_implementations, update_settings, valid_pkgname

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
# Package names given one-by-one or in a vector
load_packages(c('magrittr', 'dplyr'))
load_packages('magrittr', 'dplyr')

# Package names may be unquoted
load_packages(magrittr, dplyr)
load_packages('magrittr','dplyr', install_packages=FALSE)

## End(Not run)

hgvandenboorn/hgutils documentation built on Sept. 9, 2019, 2:50 a.m.