lib.install: Install packages and tarballs into R_MV_library

View source: R/VC_library_writing.R

lib.installR Documentation

Install packages and tarballs into R_MV_library

Description

This family of functions can help with installing packages without the risk of installing every minor package improvement as soon as it is released.

  1. lib.install_tarball can install a tarball based on the tarball location and it's dependencies (like c(dplyr = '> 5.0')).

  2. lib.install_if_not_compatible can install CRAN package depending on a condition. This is especially useful (and used on the background) for installing the dependencies for the tarball installation.

  3. lib.install can install CRAN packages into the R_MV_library, which in return is used by lib.install_if_not_compatible.

Usage

lib.install(
  package_names = NULL,
  lib_location = lib.location(),
  install_temporarily = FALSE,
  allow_overwrite_on_convert = FALSE,
  quiet = TRUE,
  cran_url = "http://cran.us.r-project.org"
)

lib.install_if_not_compatible(
  package_conditions,
  lib_location = lib.location(),
  install_temporarily = FALSE,
  allow_overwrite_on_convert = FALSE,
  quiet = TRUE,
  cran_url = "http://cran.us.r-project.org"
)

lib.install_tarball(
  tarball,
  dependencies = c(),
  lib_location = lib.location(),
  install_temporarily = FALSE,
  allow_overwrite_on_convert = c("tarball", "dependencies"),
  cran_url = "http://cran.us.r-project.org"
)

Arguments

package_names

Provide a vector of package names. A version cannot be supplied.

lib_location

The folder where this package can be installed. The package will first be installed in a temporary install folder <multiversion lib>/TEMP_install_location indicated by the lib.location_install_dir() function. If install_temporarily is set to FALSE (the default), the installed package(s) is moved to the lib_location automatically.

install_temporarily

If FALSE, the installed packages are moved to the R_MV_library, specified by the lib_location argument, automatically. Otherwise it is necessary to run lib.convert() manually after the installation into the temporary folder finished. When multiple tarballs are provided, this is set to FALSE with no warning.

allow_overwrite_on_convert

Can be used if you are experimenting and you would like to overwrite the installed (tarball) package. Only makes sense with install_temporarily on FALSE. See details below.

quiet

Will affect install.packages(..., quiet = quiet).

cran_url

Will be passed trough to the install.packages command.

package_conditions

Provide a vector of package name/'version condition' specifications. See section 'limitations for package_conditions'.

tarball

The complete path to the tarball file that you would like to install.

dependencies

Provide the dependencies like a package version combination: c(dplyr = '>= 0.5', data.table = '', R6 = '0.1.1'). Note that all dependencies must refer to packages on CRAN. Otherwise install the dependency manually somewhere and use lib.convert to include it.

Value

Nothing is returned, this function is called for it's side-effect of installing a package in the multiversion library.

limitations for package_conditions

All version specifications are allowed except for the exact version indication (e.g. don't provide c(dplyr = '1.2.3')). It is allowed to provide no specification, which will match any installed version of that package. If the condition is met, the package is skipped, which is the desired behavior for dependencies. For an empty condition (e.g. c(dplyr = '')), it will only install the package when no version is installed at all.

Allow overwrite on convert

When an installed package is converted to the R_MV_library, it would normally show that it failed to copy the packages of which that version was already present. This means that these packages were already converted from the temporary library to the R_MV_library structure before, and no lib.clean_install_dir() was performed yet. In case you are experimenting with a self made tarball package, and you are developing the package within the same package version, it is some times desired to overwrite the already present installed package with a new installation. For CRAN packages, this options doesn't make sense.

Only for lib.install_tarball, the options TRUE, FALSE, and additionally "tarball" "dependencies" are allowed. 'dependencies' will affect all packages that are in the temporary installation location except for the tarball package. 'tarball' will only overwrite the tarball package.

Installing temporarily

Installing a package temporarily gives you the opportunity to test the package before adding it to the multiversion library structure. Loading packages, including those in the temporary library (lib.location_install_dir()) can be done using: lib.load(..., also_load_from_temp_lib = TRUE).

Note

To clean up the installation directory, run lib.clean_install_dir().


multiversion documentation built on March 22, 2022, 1:07 a.m.