View source: R/check_geodata.R
check_geodata | R Documentation |
Checks if the required geospatial data files are present in the package's 'inst/extdata' directory. If the files are missing, they are downloaded from a specified GitHub repository. The user can specify which files to download, or download all available files by default.
check_geodata(files = NULL, overwrite = FALSE, quiet = FALSE, max_retries = 3)
files |
Character vector. The names of the data files to download. If 'NULL', all available files will be downloaded. |
overwrite |
Logical. Whether to overwrite existing files in 'inst/extdata/'. Default is 'FALSE'. |
quiet |
Logical. If 'TRUE', suppresses message outputs when files already exist. Default is 'FALSE'. |
max_retries |
Integer. The maximum number of retries if a download fails. Default is '3'. |
This function uses the 'curl' package to download files, and supports displaying a progress bar during the download process. It is particularly useful for large files or when the default download method ('download.file') is slow or unreliable.
A character vector of file paths to the downloaded or existing files.
# Check for and download all geospatial data from GitHub
file_paths <- check_geodata()
# Check and download specific files
file_paths <- check_geodata(files = c("boundary.rda"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.