Skip to content

switchr

Installing, Managing, and Switching Between Distinct Sets of Installed Packages

v0.14.8 · Mar 21, 2023 · Artistic-2.0

Description

Provides an abstraction for managing, installing, and switching between sets of installed R packages. This allows users to maintain multiple package libraries simultaneously, e.g. to maintain strict, package-version-specific reproducibility of many analyses, or work within a development/production release paradigm. Introduces a generalized package installation process which supports multiple repository and non-repository sources and tracks package provenance.

Downloads

347

Last 30 days

11083rd

1.1K

Last 90 days

4.6K

Last year

Trend: -16.6% (30d vs prior 30d)

CRAN Check Status

2 ERROR
2 NOTE
10 OK
Show all 14 flavors
Flavor Status
r-devel-linux-x86_64-debian-clang NOTE
r-devel-linux-x86_64-debian-gcc NOTE
r-devel-linux-x86_64-fedora-clang OK
r-devel-linux-x86_64-fedora-gcc OK
r-devel-macos-arm64 ERROR
r-devel-windows-x86_64 ERROR
r-oldrel-macos-arm64 OK
r-oldrel-macos-x86_64 OK
r-oldrel-windows-x86_64 OK
r-patched-linux-x86_64 OK
r-release-linux-x86_64 OK
r-release-macos-arm64 OK
r-release-macos-x86_64 OK
r-release-windows-x86_64 OK
Check details (4 non-OK)
NOTE r-devel-linux-x86_64-debian-clang

CRAN incoming feasibility

Maintainer: ‘Gabriel Becker <gabembecker@gmail.com>’

No Authors@R field in DESCRIPTION.
Please add one, modifying
  Authors@R: person(given = "Gabriel",
                    family = "Becker",
                    role = c("aut", "cre"),
                    email = "gabembecker@gmail.com")
as necessary.
NOTE r-devel-linux-x86_64-debian-gcc

CRAN incoming feasibility

Maintainer: ‘Gabriel Becker <gabembecker@gmail.com>’

No Authors@R field in DESCRIPTION.
Please add one, modifying
  Authors@R: person(given = "Gabriel",
                    family = "Becker",
                    role = c("aut", "cre"),
                    email = "gabembecker@gmail.com")
as necessary.
ERROR r-devel-macos-arm64

tests

Running ‘winpath.R’ [1s/4s]
Running the tests in ‘tests/winpath.R’ failed.
Complete output:
  > library(switchr)
  > ## if(getOption("repos")["CRAN"] == "@CRAN@")
  > ##     chooseCRANmirror(ind=1L)
  > graceful_inet(TRUE)
  $on
  [1] TRUE
  
  $silent
  [1] FALSE
  
  > checkUrlRoundtrip = function(pth) {
  +     pth = switchr:::normalizePath2(pth)
  +     furl = switchr:::makeFileURL(pth)
  +     pth2 = switchr:::fileFromFileURL(furl)
  +     if(pth != pth2)
  +         stop("Round trip result (", pth2, ") does not match original (", pth, ") when creating file URLs")
  + }
  > 
  > ## regression test to ensure that the roundtrip
  > ## between path and file url is working properly
  > checkUrlRoundtrip(getwd())
  > checkUrlRoundtrip(tempdir())
  > if(switchr:::isWindows())
  +     checkUrlRoundtrip("\\\\localhost\\c$")
  > 
  > ## regreossion test to ensure that package dependencies
  > ## are added to the dontunload list when a package
  > ## is specified
  > bef = switchrDontUnload()
  > af = switchrDontUnload("knitr")
  > stopifnot(all(tools::package_dependencies("knitr", recursive = TRUE)[[1]] %in% af))
  > 
  > 
  > ## regression test for unnecessary (and expensive)
  > ## lazy repo construction when install_packages
  > ## is passed urls for existing repos (the default
  > ## behavior).
  > tmplib = tempdir()
  > trace(lazyRepo, stop)
  Tracing function "lazyRepo" in environment <namespace:switchr>
  Warning: Tracing only in the namespace; to untrace you will need:
  untrace("lazyRepo", where = getNamespace("switchr"))
  [1] "lazyRepo"
  attr(,"package")
  [1] "switchr"
  > install_packages("switchr", repos = defaultRepos(), lib = tmplib)
  Error in rbind(avail1, avail2[new, ]) : 
    number of columns of matrices must match (see arg 2)
  Calls: install_packages ... install_packages -> install_packages -> .install_packages -> rbind
  Execution halted
ERROR r-devel-windows-x86_64

tests

Running 'winpath.R' [6s]
Running the tests in 'tests/winpath.R' failed.
Complete output:
  > library(switchr)
  > ## if(getOption("repos")["CRAN"] == "@CRAN@")
  > ##     chooseCRANmirror(ind=1L)
  > graceful_inet(TRUE)
  $on
  [1] TRUE
  
  $silent
  [1] FALSE
  
  > checkUrlRoundtrip = function(pth) {
  +     pth = switchr:::normalizePath2(pth)
  +     furl = switchr:::makeFileURL(pth)
  +     pth2 = switchr:::fileFromFileURL(furl)
  +     if(pth != pth2)
  +         stop("Round trip result (", pth2, ") does not match original (", pth, ") when creating file URLs")
  + }
  > 
  > ## regression test to ensure that the roundtrip
  > ## between path and file url is working properly
  > checkUrlRoundtrip(getwd())
  > checkUrlRoundtrip(tempdir())
  > if(switchr:::isWindows())
  +     checkUrlRoundtrip("\\\\localhost\\c$")
  > 
  > ## regreossion test to ensure that package dependencies
  > ## are added to the dontunload list when a package
  > ## is specified
  > bef = switchrDontUnload()
  > af = switchrDontUnload("knitr")
  > stopifnot(all(tools::package_dependencies("knitr", recursive = TRUE)[[1]] %in% af))
  > 
  > 
  > ## regression test for unnecessary (and expensive)
  > ## lazy repo construction when install_packages
  > ## is passed urls for existing repos (the default
  > ## behavior).
  > tmplib = tempdir()
  > trace(lazyRepo, stop)
  Tracing function "lazyRepo" in environment <namespace:switchr>
  Warning: Tracing only in the namespace; to untrace you will need:
  untrace("lazyRepo", where = getNamespace("switchr"))
  [1] "lazyRepo"
  attr(,"package")
  [1] "switchr"
  > install_packages("switchr", repos = defaultRepos(), lib = tmplib)
  Error in rbind(avail1, avail2[new, ]) : 
    number of columns of matrices must match (see arg 2)
  Calls: install_packages ... install_packages -> install_packages -> .install_packages -> rbind
  Execution halted

Check History

ERROR 11 OK · 2 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE Mar 10, 2026
NOTE r-devel-linux-x86_64-debian-clang

CRAN incoming feasibility

Maintainer: ‘Gabriel Becker <gabembecker@gmail.com>’

No Authors@R field in DESCRIPTION.
Please add one, modifying
  Authors@R: person(given = "Gabriel",
                    family = "Becker",
                    role = c("aut", "cre"),
                    email = "gabembecker@gmail.com")
as necessary.
NOTE r-devel-linux-x86_64-debian-gcc

CRAN incoming feasibility

Maintainer: ‘Gabriel Becker <gabembecker@gmail.com>’

No Authors@R field in DESCRIPTION.
Please add one, modifying
  Authors@R: person(given = "Gabriel",
                    family = "Becker",
                    role = c("aut", "cre"),
                    email = "gabembecker@gmail.com")
as necessary.
ERROR r-devel-windows-x86_64

tests

Running 'winpath.R' [6s]
Running the tests in 'tests/winpath.R' failed.
Complete output:
  > library(switchr)
  > ## if(getOption("repos")["CRAN"] == "@CRAN@")
  > ##     chooseCRANmirror(ind=1L)
  > graceful_inet(TRUE)
  $on
  [1] TRUE
  
  $silent

...[truncated]...
os = defaultRepos(), lib = tmplib)
  Error in rbind(avail1, avail2[new, ]) : 
    number of columns of matrices must match (see arg 2)
  Calls: install_packages ... install_packages -> install_packages -> .install_packages -> rbind
  Execution halted

Dependency Network

Dependencies Reverse dependencies RJSONIO RCurl switchr

Version History

new 0.14.8 Mar 10, 2026
updated 0.14.8 ← 0.14.5 diff Mar 20, 2023
updated 0.14.5 ← 0.14.3 diff Jan 31, 2022
updated 0.14.3 ← 0.14.2 diff Apr 19, 2020
updated 0.14.2 ← 0.13.5 diff Jan 25, 2020
updated 0.13.5 ← 0.13.0 diff Nov 14, 2018
updated 0.13.0 ← 0.12.7 diff Aug 24, 2018
updated 0.12.7 ← 0.12.6 diff Feb 21, 2018
updated 0.12.6 ← 0.12.5 diff Nov 6, 2017
updated 0.12.5 ← 0.11.2 diff Nov 5, 2017
updated 0.11.2 ← 0.11.0 diff Jan 11, 2017
updated 0.11.0 ← 0.10.14 diff Oct 24, 2016
updated 0.10.14 ← 0.10.13 diff May 21, 2016
updated 0.10.13 ← 0.9.19 diff May 12, 2016
updated 0.9.19 ← 0.9.18 diff Sep 16, 2015
updated 0.9.18 ← 0.9.10 diff Sep 1, 2015
updated 0.9.10 ← 0.9.6 diff Jul 1, 2015
updated 0.9.6 ← 0.9.4 diff Jun 16, 2015
updated 0.9.4 ← 0.9.3 diff Jun 5, 2015
new 0.9.3 Jun 2, 2015