Learn R Programming

healthbR (version 0.1.1)

vigitel_download: Download VIGITEL microdata for a specific year

Description

Downloads the VIGITEL survey microdata file from the Ministry of Health website. Files are cached locally to avoid repeated downloads.

Usage

vigitel_download(year, force = FALSE, cache_dir = NULL)

Value

Path to the downloaded file (invisibly)

Arguments

year

Integer. Year of the survey (use vigitel_years() to see available years).

force

Logical. If TRUE, re-download even if file exists in cache. Default is FALSE.

cache_dir

Character. Optional custom cache directory. If NULL (default), uses the standard user cache directory. Use tempdir() for temporary storage that won't persist.

Examples

Run this code
# \donttest{
# download 2023 data (uses tempdir to avoid leaving files)
vigitel_download(2023, cache_dir = tempdir())
# }

Run the code above in your browser using DataLab