load.packages: load.packages

Description Usage Arguments Examples

View source: R/packages.r

Description

Loads packages. If not available, then an install attempt will be carried out.

Usage

1
load.packages(mode=STRING, package=STRING/s, url=STRING/s, mirror=INT, force=BOOL, dependencies=BOOL/STRINGS, quietly=BOOL, stop.on.error=BOOL, lib=STRING, file.type=STRING, version=STRING)

Arguments

mode

one of 'cran' (Default), 'url', 'github' or 'biocmanager'. Determines how the package will be loaded. If mode='url' is set, then there setting the package vector is optional.

package

a vector of strings.

url

a vector of strings. Either package or url should be non-empty.

mirror

an integer between 0 and (currently) 94. If not set, will ask for user input, upon the first time that CRAN-sources are loaded.

file.type

an optional string, e.g. 'zip' or 'gz', to be use under mode='url', if the downloaded file is to be first unzipped.

lib

an optional string, the Git-repository name.

dependencies

either TRUE, FALSE or a string-vector. A string-vector is only useful in the case of installing under mode='url', and in this one may use either boolean values or a subset of c('Depends', 'Imports', 'LinkingTo', 'Suggests', 'Enhances').

force

if set TRUE, will force an installation. If FALSE (Default), will first attempt to load the package and then install.

quietly

boolean value to control the verbosity of installers.

stop.on.error

a boolean value (default FALSE). If set as TRUE, will stop, if loading any package (after attempting to install it) fails.

version

a string for package versioning. Useful only under mode='biocmanager'.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
load.packages(mirror=53, package='tidyverse', force=TRUE);
load.packages(mirror=53, package=c('tidyverse', 'Matrix'), stop.on.error=TRUE, force=TRUE);
load.packages(mirror=53, package=c('tidyverse', 'Motrix', 'cowplot'), stop.on.error=TRUE, force=TRUE); # this will stop!
load.packages(mode='github', package=c('RLogik/clusterby', 'RLogik/rbettersyntax'), dependencies=TRUE);
load.packages(mode='github', url='https://github.com/RLogik/clusterby/archive/master.zip', file.type='zip', force=TRUE, dependencies=FALSE);

## require('clusterby') will be tried first, then potentially an install, then a require.
load.packages(mode='github', package='clusterby', url='https://github.com/RLogik/clusterby/archive/master.zip', file.type='zip', dependencies=TRUE);

## End(Not run);

RLogik/rbettersyntax documentation built on Aug. 1, 2020, 10:44 p.m.