The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
datasusr provides fast, in-memory reading of DATASUS
.dbc files and a complete workflow for discovering,
downloading, and caching Brazilian public health data.
datasus_fetch()If you know the source, file type, period, and state you need,
datasus_fetch() handles listing, downloading, and reading
in a single call:
library(datasusr)
df <- datasus_fetch(
source = "SIHSUS",
file_type = "RD",
year = 2024,
month = 1,
uf = "PE"
)
dfThe result is a tibble ready for analysis with dplyr,
ggplot2, or any tidyverse tool. Files are cached by
default, so running the same call again skips the download entirely.
If you already have a .dbc file on disk, use
read_datasus_dbc() directly:
DATASUS files often have dozens of columns. Use select
to keep only what you need — this is faster and uses less memory:
By default, datasusr inspects each numeric field to
decide between integer and double. You can override this with
col_types and parse date fields with
parse_dates:
Before downloading, you can browse the internal catalog to discover which sources and file types are available:
For more control, you can use the individual functions instead of
datasus_fetch():
# 1. Build the FTP paths
datasus_build_path(source = "SIHSUS", file_type = "RD", year = 2024, month = 1)
# 2. List files (validated against FTP)
files <- datasus_list_files(
source = "SIHSUS",
file_type = "RD",
year = 2024,
month = 1:3,
uf = c("PE", "PB")
)
# 3. Download with cache
downloads <- datasus_download(files, use_cache = TRUE)
# 4. Read
x <- read_datasus_dbc(downloads$local_file[[1]])To skip FTP validation (useful when the server is slow), set
check_exists = FALSE in
datasus_list_files().
DATASUS publishes territorial reference tables (municipalities,
health regions, etc.) as CSV files. Use
datasus_get_territory() to download and read them:
Each information system has documentation files on the DATASUS FTP.
Use datasus_docs_url() to find them:
See the other vignettes for more detail:
datasusr relates to other R packages for DATASUS dataThese binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.