check_geodata {ggmapcn}R Documentation

Check and Download Geospatial Data from GitHub

Description

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.

Usage

check_geodata(files = NULL, overwrite = FALSE, quiet = FALSE, max_retries = 3)

Arguments

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'.

Details

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.

Value

A character vector of file paths to the downloaded or existing files.

Examples


# 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"))


[Package ggmapcn version 0.1.2 Index]