View source: R/datasus_catalog.R
| datasus_list_files | R Documentation |
Builds candidate file names from the internal catalog and, optionally, validates them against the DATASUS FTP.
datasus_list_files(
source,
file_type,
year = NULL,
month = NULL,
uf = NULL,
include_prelim = TRUE,
check_exists = TRUE,
timeout = 120,
ftp_use_epsv = FALSE,
verbose = TRUE
)
source |
Character vector of source codes. |
file_type |
Character vector of file type codes. |
year |
Integer vector of years. |
month |
Integer vector of months (required for monthly sources). |
uf |
Character vector of UF codes (required for UF-scoped sources). |
include_prelim |
Logical. Include preliminary data trees (default |
check_exists |
Logical. Query the FTP and keep only files that exist
(default |
timeout |
Timeout in seconds for FTP requests (default 120). |
ftp_use_epsv |
Logical. Passed to curl (default |
verbose |
Logical. Emit progress messages (default |
year must be between 1979 and next year, month between 1 and
12, and uf must be one of datasus_ufs(); invalid values raise an
error before any network access. For SIM "DO" and SINASC "DN",
uf = NULL means all UFs.
A tibble with one row per file, including its FTP URL and metadata.
tryCatch(
datasus_list_files(
source = "SIHSUS",
file_type = "RD",
year = 2024,
month = 1,
uf = c("PE", "PB"),
verbose = FALSE
),
error = function(e) message("FTP unavailable: ", conditionMessage(e))
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.