load_packages {hgutils} | R Documentation |
Load and install packages
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
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 |
return_library_statements |
makes this function only return a string containing |
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
## 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)