| preProcessParams | R Documentation |
This does downloading (via downloadFile), checksumming (Checksums),
and extracting from archives (extractFromArchive), plus cleaning up of input
arguments (e.g., paths, function names).
This is the first stage of three used in prepInputs.
preProcessParams(n = NULL)
preProcess(
targetFile = NULL,
url = NULL,
archive = NULL,
alsoExtract = NULL,
destinationPath = getOption("reproducible.destinationPath", "."),
fun = NULL,
dlFun = NULL,
quick = getOption("reproducible.quick"),
overwrite = getOption("reproducible.overwrite", FALSE),
purge = FALSE,
verbose = getOption("reproducible.verbose", 1),
.tempPath,
.callingEnv = parent.frame(),
...
)
n |
Number of non-null arguments passed to | ||||||||||||||||
targetFile |
Character string giving the filename (without relative or
absolute path) to the eventual file
(raster, shapefile, csv, etc.) after downloading and extracting from a zip
or tar archive. This is the file before it is passed to
| ||||||||||||||||
url |
Optional character string indicating the URL to download from.
If not specified, then no download will be attempted. If not entry
exists in the | ||||||||||||||||
archive |
Optional character string giving the path of an archive
containing | ||||||||||||||||
alsoExtract |
Which files to fetch or extract in addition to
The default depends on where the files are coming from, because "everything" only means something when a container bounds it:
An archive bounds what "all files" can mean, so Each element of a character vector may also be a regular expression: if an
element does not match any archive member literally (by relative path or
basename), it is passed to | ||||||||||||||||
destinationPath |
Character string of a directory in which to download
and save the file that comes from | ||||||||||||||||
fun |
Optional. If specified, this will attempt to load whatever
file was downloaded during | ||||||||||||||||
dlFun |
Optional "download function" name, such as | ||||||||||||||||
quick |
Logical. This is passed internally to | ||||||||||||||||
overwrite |
Logical. Passed to | ||||||||||||||||
purge |
Logical or Integer. | ||||||||||||||||
verbose |
Numeric, -1 silent (where possible), 0 being very quiet,
1 showing more messaging, 2 being more messaging, etc.
Default is 1. Above 3 will output much more information about the internals of
Caching, which may help diagnose Caching challenges. Can set globally with an
option, e.g., | ||||||||||||||||
.tempPath |
Optional temporary path for internal file intermediate steps.
Will be cleared | ||||||||||||||||
.callingEnv |
The environment where the function was called from. Used to find objects, if necessary. | ||||||||||||||||
... |
Additional arguments passed to
|
A list with 5 elements: checkSums (the result of a Checksums
after downloading), dots (cleaned up ..., including deprecated argument checks),
fun (the function to be used to load the preProcessed object from disk),
and targetFilePath (the fully qualified path to the targetFile).
targetFile, url, archive, alsoExtractUse preProcessParams() for a table describing various parameter combinations and their
outcomes.
* If the url is a file on Google Drive, checksumming will work
even without a targetFile specified because there is an initial attempt
to get the remove file information (e.g., file name). With that, the connection
between the url and the filename used in the ‘CHECKSUMS.txt’ file can be made.
Eliot McIntire
# preProcess() needs no url: a file already on disk is checksummed, placed in
# destinationPath, and (with fun = NA) reported rather than loaded.
dPath <- file.path(tempdir(), "preProcessExample")
shp <- system.file("ex/luxSmall/luxSmall.shp", package = "reproducible")
out <- preProcess(targetFile = shp, destinationPath = dPath, fun = NA)
basename(out$targetFilePath)
# A CHECKSUMS.txt is written, which is what makes a second call cheap.
dir(dPath)
unlink(dPath, recursive = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.