make_datasets {inldata} | R Documentation |
Create Package Datasets
Description
Create datasets for the inldata package and save each as an
R-data file with the .rda
extension, which is a format native to R.
The stats dataRetrieval, and stringi packages must be available.
This function is intended for use by inldata-package developers.
Usage
make_datasets(
path = getwd(),
destdir = file.path(path, "data"),
clean = FALSE,
tz = "America/Denver",
census_yr = 2023,
buffer_dist = 1000,
resolution = 100,
warn = 1,
timeout = 10,
compress = "xz",
seed = 0L,
quiet = FALSE
)
Arguments
path |
'character' string.
Path to the package's source directory, with tilde-expansion performed.
Defaults to the working directory.
Ensure that under the |
destdir |
'character' string.
Destination directory to write R-data files, with tilde-expansion performed.
Defaults to the |
clean |
'logical' flag. Whether to delete all pre-existing R-data files in the destination directory. |
tz |
'character' string.
Time zone specification.
Defaults to Mountain Standard Time (North America).
See |
census_yr |
'integer' number. United States census year. |
buffer_dist |
'numeric' number.
Buffer distance for the study area defined by the bounding of the sample |
resolution |
'numeric' number.
Spatial resolution of the raster grid, in meters.
Specify in units of the coordinate reference system ( |
warn |
'integer' value. Sets the handling of warning messages. Choose value of less than 0 to show no warnings, 1 to print warnings (default), and 2 to error on warnings. |
timeout |
'integer' number. Timeout for some of the internet operations, in minutes. Defaults to 10 minutes. |
compress |
'logical' flag or 'character' string.
Whether compression should be used when saving a dataset to file.
Character strings "auto", "gzip", "bzip2" and "xz" (default) are accepted.
See the |
seed |
'integer' count. Random number generator state, used to create reproducible results. |
quiet |
'logical' flag. Whether to suppress printing of debugging information. |
Details
This function retrieves and parses datasets from local and remote sources. Access to the internet is required to download data from the following remote sources:
National Elevation Dataset (NED) on Amazon's Cloud.
Spatial data from the TIGER/Line Geodatabase that contains spatial extracts from the U.S. Census Bureau's MAF/TIGER database.
National Hydrography Dataset (NHD) data from the USGS NHD file geodatabase on Amazon's Cloud.
Each of the package dataset's represents a snapshot of the data at a specified point in time.
While geospatial datasets may change very little over time
(such as the boundary of the Idaho National Laboratory),
other datasets continue to grow as new data becomes available
(such as water-quality data measured in samples
collected from wells).
To ensure that the function retrieves the most recent data versions, it is recommended to periodically check the URLs of remote sources and update them within the function. It is also advisable to document any changes in the datasets and update their help documentation accordingly.
Files downloaded during intermediate stages of the build process
are cached on your computer to speed up future builds.
You can specify the path to the cache directory by setting an environment variable named CACHE_DIR
.
By default the location of the cache directory is determined by the get_cache_dir()
command.
Value
Returns the paths to the newly created R Data files invisibly.
Author(s)
J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center
Examples
# Example requires that the 'path' argument be specified as
# the top-level directory of the inldata package repository.
## Not run:
make_datasets(destdir = tempfile(""))
## End(Not run)