download.files or install.packages in a separate process
Source:R/Require2.R
sysInstallAndDownload.RdThis uses sys package so that messaging can be controlled. This also provides
the option to parallelize by spawning multiple background process to allow
parallel e.g., downloads. Noting that if libcurl is installed (and detected
using capabilities("libcurl")), then no explicit parallelism will be allowed,
instead method = "libcurl" will be passed enabling parallel downloads.
Usage
sysInstallAndDownload(
args,
splitOn = "pkgs",
doLine = "outfiles <- do.call(download.packages, args)",
returnOutfile = FALSE,
doLineVectorized = TRUE,
tmpdir,
libPaths,
verbose
)Arguments
- args
A list with all arguments for a do.call to either
download.file,install.packagesor a custom other function e.g.,downloadAndBuildToLocalFile`.- splitOn
A character vector of the names in
argsto parallelize over. Defaults topkgs. All other named elements inargswill be assumed to be length 1 and used for every parallel process.- doLine
A character string with the
"outfiles <- do.call(..., args)"line.- returnOutfile
A logical. If
TRUE, then the names of theoutfileswill be returned.- doLineVectorized
A logical. If
TRUE, and parallism is being used, this indicates that thedoLineis a function that allows for multiple elements inargs[[splitOn[[1]]]. IfFALSE, the function will make multiple sequential calls within each parallel process to thedoLinecall.- tmpdir
A single path where all downloads will be put
- libPaths
The library path (or libraries) where all packages should be installed, and looked for to load (i.e., call
library). This can be used to create isolated, stand alone package installations, if used withstandAlone = TRUE. Currently, the path supplied here will be prepended to.libPaths()(temporarily during this call) toRequireifstandAlone = FALSEor will set (temporarily).libPaths()toc(libPaths, tail(libPaths(), 1)to keep base packages.- verbose
Numeric or logical indicating how verbose should the function be. If -1 or -2, then as little verbosity as possible. If 0 or FALSE, then minimal outputs; if
1or TRUE, more outputs;2even more. NOTE: inRequirefunction, whenverbose >= 2, also returns details as ifreturnDetails = TRUE(for backwards compatibility).