install.from.url: install.from.url

Description Usage Arguments Examples

View source: R/packages.r

Description

Allow for simpler syntax in R. Loads packages from URL, potentially unzipping if necessary. By contrast to installr, the URLs with parameters do not lead to problems.

Usage

1
install.from.url(pkg.name='...', url='...', file.type='...', install=TRUE/FALSE, require.pkg=TRUE/FALSE, force=TRUE/FALSE)

Arguments

pkg.name

a character string. Optional. Name of Package, if known. Otherwise, the proceedure extracts this from the downloaded file.

url

a character string. A url.

file.type

character. Default NULL. If not set, then system will attempt to determin whether the file is to be extracted and by what method. If set to 'zip', 'gz', '7z', etc., then an appropriate method will be applied to unpack the downloaded object.

install

boolean. Default TRUE. If set to TRUE, then the package in the downloaded object will be installed, otherwise the path of the downloaded package will be returned.

require.pkg

boolean. Default FALSE. If require.pkg=TRUE and force=FALSE and pkg.name is defined, require(pkg.name) will be called at the start. If it succeeds, no installation will take place. If require.pkg=TRUE, then require(···) will be called at the end.

force

boolean. Defaut FALSE. If set to FALSE, determines, whether library(···) / require(···) will be attempted first before installation.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
install.from.url(url='http://domain.de/mypackage.zip?parameters=areok', file.type='zip');
install.from.url(url='http://domain.de/mypackage.gz?parameters=areok', file.type='gz');
install.from.url(url='http://domain.de/mypackage.gz?parameters=areok'); ## file type will be automatically detected
install.from.url(url='http://domain.de/mypackage?parameters=areok');
path <- install.from.url(url='http://domain.de/mypackage?parameters=areok', install=FALSE);
install.packages(pkgs=path, repos=NULL, type='source');
path <- install.from.url(url='http://domain.de/mypackage?parameters=areok', install=FALSE, pkg.name='mypackage', require.pkg=TRUE); ## tries require('mypackage') first, otherwise installs package afresh.
path <- install.from.url(url='http://domain.de/mypackage?parameters=areok', install=FALSE, require.pkg=TRUE, force=TRUE); ## forces a fresh installation of the package followed by a require(···) command (package name will be automatically detected).

## End(Not run)

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