loadPkgs: Load/install or unload packages from various sources

Description Usage Arguments Details Value Author(s) Examples

Description

Load/unload one or more packages. When loading one or more packages, if not already installed, try install it/them from various repos. If url is assigned, the package will also be downloaded and installed from that alternative url.

Usage

1
2
3
4
5
loadPkgs(..., repo = c("cran", "c", "github", "g", "gh", "gitlab", "l",
  "gl", "bioconductor", "bioc", "b", "bitbucket", "k", "omegahat", "oh",
  "o"), url = NULL, quiet = TRUE)

unloadPkgs(..., force = FALSE, quiet = FALSE)

Arguments

...

Strings or expressions representing packages to load/install or unload. In the function unloadPkgs, if ... is not assigned, then all the non-default packages (base, methods, datasets, utils, grDevices, graphics, stats) will be unloaded.

repo

Currently only accepts 'cran'/'c', 'github'/'gh'/'g', 'gitlab'/'gl'/'l', 'bioconductor'/'bioc'/'b', 'bitbucket'/'k', and 'omegahat'/'oh'/'o'. Refer to Details.

url

If any of pkgs was not installed yet, and url is specified, loadPkgs will try to download and install the package from that url (It must point to a valid file on internet). Default to NULL.

quiet

Logical, default TRUE for loadPkgs and FALSE for unloadPkgs. If TRUE, the packages will be installed/loaded or unloaded(detached) quietly.

force

Logical. Should a package be detached even though other attached packages depend on it?

Details

There are several groups of repos that you can apply:

c

c or cran, you can also use install.packages()

g

g or gh or github, you can also use remotes:: install_github

b

b or bioc or bioconductor, you can also use remotes:: install_bioc

k

k or bitbucket, you can also use remotes:: install_bitbucket

l

l or gl or gitlab, you can also use remotes:: install_gitlab

o

o or oh or omegahat, you can also use install.packages with repos='http://www.omegahat.org/R', type="source"


When you don't want to use the repo, you can directly assign url to download and install the pacakge(s).

Value

invisible. If you set quiet = FALSE, the verbose information will be printed out.

Author(s)

Yiying Wang, wangy@aetna.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
## Load existing package(s)
loadPkgs(car)
loadPkgs(car, cluster)  # identical with
loadPkgs("car", "cluster")  # or
loadPkgs(c("car", "cluster"))

## Unload them simultaneously
unloadPkgs(car, cluster)

## Install a new package explcitly from CRAN and then load it
loadPkgs("tidyr", repo="c")

## Install a new package from other sources and load it
loadPkgs(hadley/svglite, hadley/purrr, repo="github")
loadPkgs(a4Base, repo="bioc")

## End(Not run)

madlogos/aseskit documentation built on June 26, 2019, 12:17 a.m.