R/packages.R
installVersions.RdThis uses CRAN, CRAN archives, or MRAN (accessed via versions::install.versions)
for remote repositories.
This will attempt to install all packages in the packageVersionFile,
with their exact version described in that file. For GitHub packages, it will
use install_github. This will be called internally by
Require, and so often doesn't need to be used by a user.
installVersions(gitHubPackages, packageVersionFile = ".packageVersions.txt", libPath = .libPaths()[1], standAlone = FALSE, repos = getOption("repos"))
| gitHubPackages | Character vectors indicating repository/packageName@branch |
|---|---|
| packageVersionFile | Path to the package version file, defaults to
the |
| libPath | The library path where all packages should be installed, and looked for to load
(i.e., call |
| standAlone | Logical. If |
| repos | The remote repository (e.g., a CRAN mirror), passed to either
|
Because of potential conflicts with loaded packages, this function will run
install.packages in a separate R process.
# NOT RUN { # requires the packageVersionFile -- this doesn't work -- safer to use Require installVersions("PredictiveEcology/reproducible@development") # make a package version snapshot -- this will be empty because no packages in directory tempPkgFolder <- file.path(tempdir(), "Packages") dir.create(tempPkgFolder) packageVersionFile <- file.path(tempPkgFolder, ".packageVersion.txt") pkgSnapshot(libPath=tempPkgFolder, packageVersionFile) Require("crayon", libPath = tempPkgFolder) # install.packages first, then library # install a specific version # make a package version snapshot packageVersionFile <- file.path(tempPkgFolder, ".packageVersion.txt") pkgSnapshot(libPath=tempPkgFolder, packageVersionFile, standAlone = FALSE) installVersions("crayon", packageVersionFile = packageVersionFile) # }