switchTo

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
switchTo(name, seed = NULL, reverting = FALSE, ignoreRVersion = FALSE,
  ...)

## S4 method for signature 'character,character'
switchTo(name, seed = NULL,
  reverting = FALSE, ignoreRVersion = FALSE, ...)

## S4 method for signature 'character,SwitchrCtx'
switchTo(name, seed = NULL,
  reverting = FALSE, ignoreRVersion = FALSE, ...)

## S4 method for signature 'character,missing'
switchTo(name, seed = NULL, reverting = FALSE,
  ignoreRVersion = FALSE, ...)

## S4 method for signature 'SwitchrCtx,ANY'
switchTo(name, seed = NULL, reverting = FALSE,
  ignoreRVersion = FALSE, ...)

## S4 method for signature 'character,RepoSubset'
switchTo(name, seed = NULL,
  reverting = FALSE, ignoreRVersion = FALSE, ...)

## S4 method for signature 'character,PkgManifest'
switchTo(name, seed = NULL,
  reverting = FALSE, ignoreRVersion = FALSE, ...)

## S4 method for signature 'character,SessionManifest'
switchTo(name, seed = NULL,
  reverting = FALSE, ignoreRVersion = FALSE, ...)

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.

...

Passed directly to installCompEnv 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).

Value

Invisibly returns the SwitchrCtx object representing the new computing environment

Note

By default, this process involves a call to flushSession which will attempt to unload all loaded packages. While some support of configuring what is unloaded is provided via switchrDontUnload, it is recommended that you turn this feature entirely off via switchrNoUnload(TRUE) when using switchr within dyanmic documents (.Rnw/.Rmd files, etc), particularly when using the knitr package.

Examples

1
2
3
4
5
6
7
8
## Not run: 
switchTo("mynewlibrary")
switchBack()

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

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.