Learn R Programming

switchr (version 0.14.8)

switchTo: switchTo

Description

Switch to a different computing environment (set of installed R packages and library location paths for new pkg installs)

Usage

switchTo(
  name,
  seed = NULL,
  reverting = FALSE,
  ignoreRVersion = FALSE,
  exclude.site = TRUE,
  ...
)

# S4 method for character,character switchTo( name, seed = NULL, reverting = FALSE, ignoreRVersion = FALSE, exclude.site = TRUE, ... )

# S4 method for character,SwitchrCtx switchTo( name, seed = NULL, reverting = FALSE, ignoreRVersion = FALSE, exclude.site = TRUE, ... )

# S4 method for character,missing switchTo( name, seed = NULL, reverting = FALSE, ignoreRVersion = FALSE, exclude.site = TRUE, ... )

# S4 method for SwitchrCtx,ANY switchTo( name, seed = NULL, reverting = FALSE, ignoreRVersion = FALSE, exclude.site = TRUE, ... )

# S4 method for character,RepoSubset switchTo( name, seed = NULL, reverting = FALSE, ignoreRVersion = FALSE, exclude.site = TRUE, ... )

# S4 method for character,PkgManifest switchTo( name, seed = NULL, reverting = FALSE, ignoreRVersion = FALSE, exclude.site = TRUE, ... )

# S4 method for character,SessionManifest switchTo( name, seed = NULL, reverting = FALSE, ignoreRVersion = FALSE, exclude.site = TRUE, ... )

Value

Invisibly returns the SwitchrCtx object representing the new computing environment

Arguments

name

The name associated (or to associate) with the computing environment.

seed

The seed, indicating packages to install into a newly created package library No effect if the library already exists

reverting

Indicates whether we are reverting to the environment in use before the current one. Typically not set directly by the user.

ignoreRVersion

Should the R version in use be ignored when checking for existing computing environmeSnts. This is experimental.

exclude.site

Should the Site library be excluded when creating and switching to the specified library. Defaults to TRUE

...

Passed directly to makeLibraryCtx if an existing computing environment is not found.

Details

If switchr does not now about the specified computing environment, a new one will be created via installCompEnv. This includes creating a directory under the switchr base directory and installing packages into it. See installCompEnv for more details.

This function has the side effect of unloading all loaded packages (other than base packages, GRAN or GRANBAse, switchr itself, and switchr's dependencies) and the associated DLLs. It also changes the library location R will use to search for packages, e.g. when you call library.

This means you will have to reinstall packages after switching, which is important and intended (e.g. when switching to using Bioc devel from Bioc release).

References

Becker G, Barr C, Gentleman R, Lawrence M; Enhancing Reproducibility and Collaboration via Management of R Package Cohorts. Journal of Statistical Software, 81(1). 2017. doi: 10.18637/jss.v082.i01

See Also

makeLibraryCtx

Examples

Run this code
if (FALSE) {
switchTo("mynewlibrary")
switchBack()

fdman = GithubManifest("gmbecker/fastdigest")
switchTo("fastdigestlib", seed = fdman)
}

Run the code above in your browser using DataLab