createPkgLoader {FastUtils} | R Documentation |
Create Package Loader Function
Description
This function creates a package loader function that can install and load packages from CRAN, Bioconductor, or GitHub, optionally displaying verbose output. This function can be useful in new R instances with little dependencies available.
The function takes the following arguments:
-
cran
-
bioc
-
gh
-
verbose
where cranand
bioctake character vectors of package names on CRAN and Bioconductor, while
ghtakes character vectors with the formatting
githubUsername/packageName.
verbose' takes in a logical for whether
to display additional informative messages in the REPL.
The function will not install packages that can already be loaded by default.
Usage
createPkgLoader(lib = .libPaths()[1])
Arguments
lib |
A character vector specifying the library directory for package
installation of the output function. Defaults to the current default
package installation directory in |
Value
A function that installs and loads packages.
Examples
# Create the package loader function
loader <- createPkgLoader()
# # commented usage example
# loader(
# cran = c("dplyr", "ggplot2"),
# bioc = c("GenomicRanges", "Biobase"),
# gh = c("tidyverse/dplyr"),
# verbose = FALSE
# )