Description Usage Arguments Details Value TODO Note Examples
This function is used to automatically update out-of-date existing packages and install new packages prior to loading them. The packages are provided in either a list of characters or character vector. Base packages are not updated, download the newest version of R to fix base packages being out-of-date. It is a wrapper for both base R packages and pacman, which is a package for dealing with package management.
1 2 |
packages |
Takes in either a vector of package name strings, or a list of package names. |
lib |
The installation working directory for packages. The first item of .libPaths() is our default choice. If you do not have a user created library, R will likely prompt you to create one. |
repos |
This should default to your Rstudio setting or profile setting, we recommend setting one if you have not already. Our default choice is "https://cran.rstudio.com/". |
update |
When set to TRUE, an attempt is made to update any outdated 'packages' input(s) to the most up-to-date CRAN packages. Note you cannot update base R packages if they are in an locked-down OS generated folder. |
verbose |
Allow user to see more messages. Defaults to FALSE, which gives minimal messages (some are just too important to turn off). You can turn off all package messages in your options if desired. |
sys.override |
Default value of FALSE, as out-of-date system packages may be an indication of an out-of-date R installation. However, if you really want to update system packages, set this argument to TRUE. It will install system packages in the R user library, as installing them in the system library is error-prone as your OS could prevent this. |
... |
Arguments to be passed in from
|
This is just a wrapper to provide full automation.
A list with multiple items: installed for packages installed, loaded for packages loaded, updated for packages updated, install_fail for packages that failed to install, load_fail for packages that failed to load, updated_fail for packages that failed to update.
Currently working on extended robust version.
Prospective Features: Adding version updates for non-cran github repos.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Not run:
pkg_loader("splines")
packages = list("data.table", "reshape2")
pkg_loader(packages)
packages = c("data.table", "reshape2")
pkg_loader(packages)
pkg_loader(c("fakePackage", "fake2")) # causes error
pkg_loader(packages = "data.table", update = TRUE)
pkg_loader(packages = c("MASS", "data.table", "splines"),
update = TRUE, sys.override = TRUE)
aux <- new.env(parent = .GlobalEnv)
aux$packages <- c("xtable", "knitr", "data.table",
"ggplot2", "zoo", "xlsx", "RODBC")
debugonce(pkg_loader)
pkg_loader(aux$packages, verbose = TRUE,
repos = "cran.cnr.berkeley.edu")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.