Install specified version of a CRAN package.
If you are installing an package that contains compiled code, you will
need to have an R development environment installed. You can check
if you do by running
devtools::has_devel (you need the
devtools package for this).
install_version(package, version = NULL, dependencies = NA, upgrade = c("default", "ask", "always", "never"), force = FALSE, quiet = FALSE, build = FALSE, build_opts = c("--no-resave-data", "--no-manual", "--no-build-vignettes"), repos = getOption("repos"), type = "source", ...)
If the specified version is NULL or the same as the most recent version of the package, this function simply calls
utils::install.packages(). Otherwise, it looks at the list of archived source tarballs and tries to install an older version instead.
logical indicating whether to also install uninstalled packages which these packages depend on/link to/import/suggest (and so on recursively). Not used if
repos = NULL. Can also be a character vector, a subset of
c("Depends", "Imports", "LinkingTo", "Suggests", "Enhances").
Only supported if
libis of length one (or missing), so it is unambiguous where to install the dependent packages. If this is not the case it is ignored, with a warning.
c("Depends", "Imports", "LinkingTo").
TRUEmeans to use
c("Depends", "Imports", "LinkingTo", "Suggests")for
c("Depends", "Imports", "LinkingTo")for added dependencies: this installs all the packages needed to run
pkgs, their examples, tests and vignettes (if the package author specified them correctly).
In all of these,
"LinkingTo"is omitted for binary packages.
One of "default", "ask", "always", or "never". "default" respects the value of the
R_REMOTES_UPGRADEenvironment variable if set, and falls back to "ask" if unset. "ask" prompts the user for which out of date packages to upgrade. For non-interactive sessions "ask" is equivalent to "always".
FALSEare also accepted and correspond to "always" and "never" respectively.
Force installation, even if the remote state has not changed since the previous install.
logical: if true, reduce the amount of output.
TRUEbuild the package before installing.
Options to pass to
R CMD build, only used when
character vector, the base URL(s) of the repositories to use, e.g., the URL of a CRAN mirror such as
"https://cloud.r-project.org". For more details on supported URL schemes see
NULLto install from local files, directories or URLs: this will be inferred by extension from
pkgsif of length one.
character, indicating the type of package to download and install. Will be
"source"except on Windows and some macOS builds: see the section on ‘Binary packages’ for those.
Other arguments passed on to