Skip to contents

Downloads the complete Infosiga.SP database from the official website, handles potential HTTP errors with retries, and extracts the contents of the resulting ZIP file to a specified directory.

Usage

download_infosiga(destpath)

Arguments

destpath

A string specifying the directory path where the data files should be extracted. The path will be normalized, and if it's a relative path, it will be resolved from the current working directory.

Value

This function does not return a value. It is called for its side effects: downloading a file and extracting it to the destpath.

Details

The function performs the download to a temporary file and then unzips it. It uses a robust httr2 request that forces HTTP/1.1, sets a common User-Agent, and automatically retries the download up to 3 times in case of transient network errors. A progress bar is displayed during the download.

Examples

if (FALSE) { # \dontrun{
# Create a temporary directory to store the data
temp_dir <- tempdir()

# Download and extract the data
download_infosiga(destpath = temp_dir)
} # }