groundhog.library {groundhog} | R Documentation |
Install & load CRAN, GitHub, and GitLab packages as current on given date
Description
Load requested package(s) as current on a requested date. If the needed version
of a package, or its dependencies, is not already installed, groundhog automatically
installs it. groundhog.library()
thus substitutes both library()
and install.packages()
. There is no change in setup or configuration parameters
needed to start using groundhog; simply edit your script going between
library()
and groundhog.library()
as needed. Groundhog often installs/uninstalls
packages in the default personal library. These changes can be reversed in a few seconds,
with restore.library()
Usage
groundhog.library(
pkg,
date,
quiet.install = TRUE,
include.suggests = FALSE,
ignore.deps = c(),
force.source = FALSE,
force.install = FALSE,
force.source.main = FALSE,
force.install.main = FALSE,
tolerate.R.version = "",
cores = -1
)
Arguments
pkg |
character string or vector with name of package(s) to load/install. |
date |
character string (yyyy-mm-dd), or date value, with the date which determines the version of the package, and all dependencies, to be loaded (and installed if needed). The most recent date accepted is 2 days prior to when the code is executed. |
quiet.install |
logical, defaults to |
include.suggests |
logical, defaults to |
ignore.deps |
an optional character vector containing dependencies which are already loaded in the R session, and create a conflict with a needed dependency for the package being loaded (mismatch of version), but which should be ignored and groundhog.library() should proceed tolerating the conflict. |
force.source |
logical (defaults to |
force.install |
logical (defaults to |
force.source.main |
logical (defaults to |
force.install.main |
logical (defaults to |
tolerate.R.version |
optional character string containing an R version
which |
cores |
Integer. The maximum number of cores to use during parallel installation
of source packages. The default, -1, uses the total number of cores available minus 1.
Setting |
Details
For more information about groundhog check out groundhogr.com
Examples
## Not run:
groundhog.library("magrittr", "2022-04-15")
pkgs <- c('pwr','metafor')
groundhog.library(pkgs, "2022-04-15")
# When running an existing script that relied on `library()` to load packages,
# you can wrap the library calls in double-quotes, loading the packages with
# groundhog:
groundhog.library(
"
library('pwr')
library('metafor')
library('tidyr')
library('rio')
library('this.path')
"
,'2022-04-01')
#Allow using R 3.6.3 despite entering a date that corresponds to R >=4.0.0
groundhog.library('rio', '2022-04-11', tolerate.R.version='3.6.3')
## End(Not run)