| opendatasus_baixar | R Documentation |
Resolves a resource from the live portal metadata, downloads it atomically and records its origin and MD5 checksum. By default, files are reused from the package cache. A cached file is refreshed automatically when the resource update timestamp changes.
opendatasus_baixar(
conjunto,
recurso = NULL,
ano = "last",
formato = NULL,
destino = NULL,
cache = TRUE,
atualizar = FALSE
)
conjunto |
Dataset slug returned by [opendatasus_catalogo()]. |
recurso |
Optional exact resource name or stable resource identifier. |
ano |
Resource year, '"last"' for the latest dated resource, or 'NULL'. Ignored when 'recurso' is supplied. |
formato |
Resource format. When both 'recurso' and 'formato' are 'NULL', CSV is preferred. |
destino |
Optional destination file or existing directory. 'NULL' uses the package cache, or a temporary file when 'cache = FALSE'. |
cache |
Whether to cache portal metadata for the duration controlled by option 'datasus.cache_ttl'. |
atualizar |
Whether to ignore cached metadata and query the portal again. |
The normalized local file path, with classes '"datasus_arquivo"' and '"character"'. Use [datasus_proveniencia()] to inspect its origin.
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
file <- opendatasus_baixar(
"arboviroses-dengue",
ano = 2025,
formato = "CSV"
)
datasus_proveniencia(file)
})
options(old_options)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.