determineFilename {reproducible} | R Documentation |
Determine filename, either automatically or manually
Description
Determine the filename, given various combinations of inputs.
Usage
determineFilename(
filename2 = NULL,
filename1 = NULL,
destinationPath = getOption("reproducible.destinationPath", "."),
verbose = getOption("reproducible.verbose", 1),
prefix = "Small",
...
)
Arguments
filename2 |
|
filename1 |
Character strings giving the file paths of
the input object ( |
destinationPath |
Optional. If |
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., |
prefix |
The character string to prepend to |
... |
Passed into |
Details
The post processing workflow, which includes this function,
addresses several scenarios, and depending on which scenario, there are
several file names at play. For example, Raster
objects may have
file-backed data, and so possess a file name, whereas Spatial
objects do not. Also, if post processing is part of a prepInputs()
workflow, there will always be a file downloaded. From the perspective of
postProcess
, these are the "inputs" or filename1
.
Similarly, there may or may not be a desire to write an
object to disk after all post processing, filename2
.
This subtlety means that there are two file names that may be at play:
the "input" file name (filename1
), and the "output" filename (filename2
).
When this is used within postProcess
, it is straight forward.
However, when postProcess
is used within a prepInputs
call,
the filename1
file is the file name of the downloaded file (usually
automatically known following the downloading, and refered to as targetFile
)
and the filename2
is the file name of the of post-processed file.
If filename2
is TRUE
, i.e., not an actual file name, then the cropped/masked
raster will be written to disk with the original filenam1/targetFile
name, with prefix
prefixed to the basename(targetFile
).
If filename2
is a character string, it will be the path of the saved/written
object e.g., passed to writeOutput
. It will be tested whether it is an
absolute or relative path and used as is if absolute or
prepended with destinationPath
if relative.
If filename2
is logical
, then the output
filename will be prefix
prefixed to the basename(filename1
).
If a character string, it
will be the path returned. It will be tested whether it is an
absolute or relative path and used as is if absolute or prepended with
destinationPath
if provided, and if filename2
is relative.