datadir_bc {rasterbc} | R Documentation |
Set local directory for storage of raster data files
Description
All files downloaded/created by the rasterbc package are written to the directory assigned
by this function. The path to this directory is stored in the global options list for R under
'rasterbc.data.dir'. To set this path, call datadir_bc
and pass the path as argument
data.dir
. To check the current setting, call datadir_bc()
without arguments.
Usage
datadir_bc(data.dir = NULL, quiet = FALSE)
Arguments
data.dir |
character string, the absolute path to the desired storage directory |
quiet |
logical indicating to skip confirmation prompt and warnings about existing directories |
Details
If data.dir=NA
, the data storage directory is set to the a subdirectory of base::tempdir()
,
a per-session temporary directory (cleared after each R session). This happens automatically if
opendata_bc
or getdata_bc
are called before datadir_bc
, ensuring that rasterbc
won't
unexpectedly overwrite things or leave garbage in the user's file system.
However, users are strongly encouraged to set the data directory manually to a non-temporary
location. This allows copies of downloaded data to persist between sessions, so that
rasterbc::opendata_bc
can load the local copies in future R sessions. This is both much faster
than downloading mapsheets repeatedly, and it reduces the strain on FRDR's data hosting service.
The directory data.dir
will be created if it doesn't already exist.
Value
character string, the absolute path to the data storage directory
Examples
# call without arguments to get the current directory (or a prompt to set it, if unset)
datadir_bc()
# call with argument NA to set a default location
datadir_bc(NA, quiet=TRUE)
datadir_bc()