Learn R Programming

healthbR

Overview

healthbR provides easy access to Brazilian public health data directly from R. The package downloads, caches, and processes data from official sources, returning clean, analysis-ready tibbles following tidyverse conventions.

Surveys (IBGE / Ministry of Health)

ModuleDescriptionYears
VIGITELSurveillance of Risk Factors for Chronic Diseases by Telephone Survey2006--2024
PNSNational Health Survey (microdata + SIDRA API)2013, 2019
PNAD ContinuaContinuous National Household Sample Survey2012--2024
POFHousehold Budget Survey (food security, consumption, anthropometry)2002--2018
CensoPopulation denominators via SIDRA API1970--2022

DATASUS (Ministry of Health FTP)

ModuleDescriptionGranularityYears
SIMMortality Information System (deaths)Annual/UF1996--2024
SINASCLive Birth Information SystemAnnual/UF1996--2024
SIHHospital Information System (admissions)Monthly/UF2008--2024
SIAOutpatient Information System (13 file types)Monthly/type/UF2008--2024

DATASUS modules download .dbc files (compressed DBF) and decompress them internally using vendored C code -- no external dependencies required.

Installation

You can install the development version of healthbR from GitHub:

# install.packages("pak")
pak::pak("SidneyBissoli/healthbR")

Quick start

library(healthbR)

# see all available data sources
list_sources()

DATASUS modules

All DATASUS modules follow a consistent API: *_years(), *_info(), *_variables(), *_dictionary(), *_data(), *_cache_status(), *_clear_cache().

# mortality data -- deaths in Acre, 2022
obitos <- sim_data(year = 2022, uf = "AC")

# filter by cause of death (CID-10 prefix)
obitos_cardio <- sim_data(year = 2022, uf = "AC", cause = "I")

# live births in Acre, 2022
nascimentos <- sinasc_data(year = 2022, uf = "AC")

# hospital admissions in Acre, January 2022
internacoes <- sih_data(year = 2022, month = 1, uf = "AC")

# filter by diagnosis (CID-10 prefix)
intern_resp <- sih_data(year = 2022, month = 1, uf = "AC", diagnosis = "J")

# outpatient production in Acre, January 2022
ambulatorial <- sia_data(year = 2022, month = 1, uf = "AC")

# different file type (e.g., high-cost medications)
medicamentos <- sia_data(year = 2022, month = 1, uf = "AC", type = "AM")

Survey modules

# VIGITEL telephone survey
vigitel <- vigitel_data(year = 2024)

# PNS national health survey
pns <- pns_data(year = 2019)

# PNAD Continua
pnadc <- pnadc_data(year = 2023, quarter = 1)

# POF household budget survey
pof <- pof_data(year = 2018, register = "morador")

# Census population
pop <- censo_populacao(year = 2022, territorial_level = "state")

Explore variables and dictionaries

# list variables for any module
sim_variables()
sia_variables(search = "sexo")

# data dictionary with category labels
sim_dictionary("SEXO")
sia_dictionary("PA_RACACOR")

Caching

All modules cache downloaded data automatically. Install arrow for optimized Parquet caching:

install.packages("arrow")

Each module provides cache management functions:

# check what is cached
sim_cache_status()
sih_cache_status()
sia_cache_status()

# clear cache for a module
sim_clear_cache()

Data sources

All data is downloaded from official Brazilian government repositories:

Citation

If you use healthbR in your research, please cite it:

citation("healthbR")

Contributing

Contributions are welcome! Please open an issue to discuss proposed changes or submit a pull request.

Code of Conduct

Please note that the healthbR project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

MIT © Sidney da Silva Pereira Bissoli

Copy Link

Version

Install

install.packages('healthbR')

Version

0.2.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Sidney Bissoli

Last Published

February 15th, 2026

Functions in healthbR (0.2.0)

cnes_cache_status

Show CNES Cache Status
cnes_clear_cache

Clear CNES Cache
healthbR-package

healthbR: Access Brazilian Public Health Data
censo_populacao

Get Census population data
list_sources

List Available Data Sources
has_partitioned_cache

Check if partitioned cache exists
get_arrow_column_names

Get all available columns from Arrow dataset
cnes_variables

List CNES Variables
pns_info

PNS survey information
pnadc_variables

List PNADC variables
pns_sidra_search

Search PNS SIDRA tables
cnes_info

CNES Module Information
pns_sidra_data

Get PNS tabulated data from SIDRA API
pns_modules

List PNS survey modules
pnadc_years

List available years for a PNADC module
pns_sidra_tables

List PNS SIDRA tables
pnadc_dictionaries

Download PNADC variable dictionary
pnadc_data

Download PNADC microdata
pns_variables

List PNS variables
pof_dictionary

Get POF variable dictionary
pof_years

List available POF survey years
pof_info

Get POF survey information
sih_data

Download SIH Hospital Admission Microdata
sia_cache_status

Show SIA Cache Status
pnadc_clear_cache

Clear PNADC cache
cnes_years

List Available CNES Years
create_partitioned_cache

Create partitioned parquet cache
pns_clear_cache

Clear PNS cache
pns_cache_status

Get PNS cache status
pnadc_cache_status

Get PNADC cache status
pns_years

List available PNS survey years
sim_clear_cache

Clear SIM Cache
pof_cache_status

Get POF cache status
sih_cache_status

Show SIH Cache Status
sim_data

Download SIM Mortality Microdata
sih_clear_cache

Clear SIH Cache
sia_dictionary

SIA Data Dictionary
sinan_cache_status

Show SINAN Cache Status
sih_info

SIH Module Information
sia_info

SIA Module Information
sih_variables

List SIH Variables
sih_dictionary

SIH Data Dictionary
sinan_data

Download SINAN Notifiable Disease Microdata
cnes_data

Download CNES Health Facility Registry Data
sinan_info

SINAN Module Information
sinan_diseases

List Available SINAN Diseases
sinan_years

List Available SINAN Years
sia_clear_cache

Clear SIA Cache
sim_years

List Available SIM Years
sinasc_years

List Available SINASC Years
sia_data

Download SIA Outpatient Production Microdata
sim_variables

List SIM Variables
sipni_cache_status

Show SI-PNI Cache Status
sinan_variables

List SINAN Variables
sinan_clear_cache

Clear SINAN Cache
sinasc_info

SINASC Module Information
sinan_dictionary

SINAN Data Dictionary
pof_variables

List POF variables
pof_registers

List POF registers
sinasc_variables

List SINASC Variables
sinasc_data

Download SINASC Live Birth Microdata
sipni_variables

List SI-PNI Variables
sinasc_dictionary

SINASC Data Dictionary
vigitel_extract_zip

Extract VIGITEL ZIP file
sipni_years

List Available SI-PNI Years
vigitel_base_url

Get VIGITEL base URL
utils

Utility Functions for healthbR
vigitel_dictionary

Get VIGITEL variable dictionary
sipni_clear_cache

Clear SI-PNI Cache
sim_cache_status

Show SIM Cache Status
sinasc_cache_status

Show SINASC Cache Status
sinasc_clear_cache

Clear SINASC Cache
sih_years

List Available SIH Years
vigitel_download_data

Download VIGITEL data file
vigitel_cache_dir

Get VIGITEL cache directory
vigitel_identify_year_column

Identify year column in VIGITEL data
sipni_data

Download SI-PNI Vaccination Data
pnadc_modules

List available PNADC modules
pns_dictionary

Download PNS variable dictionary
pof_clear_cache

Clear POF cache
pns_data

Download PNS microdata
cnes_dictionary

CNES Data Dictionary
pnadc_info

PNADC survey information
pof_data

Download and import POF microdata
sia_variables

List SIA Variables
sisab_cache_status

Show SISAB Cache Status
sisab_clear_cache

Clear SISAB Cache
sia_years

List Available SIA Years
sim_info

SIM Module Information
sim_dictionary

SIM Data Dictionary
sipni_dictionary

SI-PNI Data Dictionary
vigitel_read_data

Read VIGITEL data file
sipni_info

SI-PNI Module Information
sisab_variables

List SISAB Variables
vigitel_cache_status

Get VIGITEL cache status
vigitel_variables

List VIGITEL variables
vigitel_info

Get VIGITEL survey information
sisab_data

Download SISAB Coverage Data
vigitel_identify_year_column_from_schema

Identify year column from Arrow schema
sisab_info

SISAB Module Information
vigitel_clear_cache

Clear VIGITEL cache
vigitel_data

Download VIGITEL microdata
sisab_years

List Available SISAB Years
vigitel_years

List available VIGITEL survey years
ans_variables

List ANS Variables
ans_info

ANS Module Information
ans_years

List Available ANS Years
anvisa_cache_status

Show ANVISA Cache Status
ans_data

Download ANS Data
ans_operators

Download ANS Operators Registry
anvisa_clear_cache

Clear ANVISA Cache
anvisa_data

Download ANVISA Data
ans_cache_status

Show ANS Cache Status
ans_clear_cache

Clear ANS Cache
censo_estimativa

Get intercensitary population estimates
anvisa_variables

List ANVISA Variables
censo_sidra_data

Get Census data from SIDRA API
censo_sidra_search

Search Census SIDRA tables
censo_info

Census information
anvisa_info

ANVISA Module Information
anvisa_types

List ANVISA Data Types
censo_years

List available Census years
censo_sidra_tables

List Census SIDRA tables