| Type: | Package |
| Title: | An Interface to Brazilian Public Health Data |
| Version: | 0.16.1 |
| Description: | Retrieves public health data from the Department of Informatics ('DATASUS') of the Brazilian Unified Health System ('Sistema Unico de Saude', 'SUS') through its online tabulation service and open-data catalog. It covers the Mortality Information System ('SIM'), Live Birth Information System ('SINASC'), Hospital Information System of the Unified Health System ('SIH/SUS'), Outpatient Information System of the Unified Health System ('SIA/SUS'), National Register of Health Establishments ('CNES'), Notifiable Diseases Information System ('SINAN'), National Immunization Program ('PNI'), Cancer Information System ('SISCAN'), and Food and Nutrition Surveillance System ('SISVAN'). Contemporary sources from the 'OpenDataSUS' portal include Events Supposedly Attributable to Vaccination or Immunization ('ESAVI'), influenza-like illness notifications from 'e-SUS Notifica', individual vaccination doses, coronavirus disease 2019 (COVID-19) hospital occupancy, and record-level mortality, live-birth and hospital-admission microdata. Curated schemas, selective columns, multipart downloads and chunk processing support memory-efficient analysis of large files. The package also provides grouped epidemiological indicators, confidence intervals, population-denominator joins, epidemiological calendars, moving averages and direct age standardization. An offline reference from the Brazilian Institute of Geography and Statistics (IBGE) supports territorial codes, joins and completion of geographic time series. |
| License: | GPL-3 |
| Encoding: | UTF-8 |
| URL: | https://github.com/rpradosiqueira/datasus |
| BugReports: | https://github.com/rpradosiqueira/datasus/issues |
| Depends: | R (≥ 4.1.0) |
| Imports: | datasusr (≥ 0.1.0), httr2, jsonlite, readr, rvest, stringi, xml2 |
| Suggests: | foreign, knitr, rmarkdown, testthat (≥ 3.0.0) |
| VignetteBuilder: | knitr |
| Config/testthat/edition: | 3 |
| RoxygenNote: | 8.0.0 |
| NeedsCompilation: | no |
| Packaged: | 2026-08-24 11:54:01 UTC; renat |
| Author: | Renato Prado Siqueira [aut, cre] |
| Maintainer: | Renato Prado Siqueira <rpradosiqueira@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-09-05 13:10:02 UTC |
datasus: Brazilian public health data
Description
'datasus' provides a stable interface to aggregated TABNET queries, OpenDataSUS resources, record-level DATASUS files, territorial references and epidemiological analysis helpers. Discovery functions can be used before any download, and local catalogs and transformations remain usable without network access.
Main workflow
Start with [datasus_catalogo()] for supported TABNET datasets, [opendatasus_catalogo()] for contemporary portal datasets, or [microdados_catalogo()] for raw DBC/DBF file families. Plan requests with [datasus_opcoes()], [opendatasus_recursos()], [opendatasus_arquivos()] or [microdados_arquivos()] before querying or downloading data.
Use [opendatasus_baixar()] and [microdados_baixar()] when another engine will read the files, or [opendatasus_ler()] and [microdados_ler()] for in-memory workflows. System-specific functions such as [sim()], [sinasc()], [sih_producao()] and [cnes()] provide concise entry points for common data products.
Reproducibility and validation
Downloaded objects carry source, consultation time, local path and checksum metadata retrievable with [datasus_proveniencia()]. Use [datasus_dicionario()] and [datasus_validar_esquema()] to inspect curated fields and detect missing or type-incompatible analysis fields. Cache paths use [tools::R_user_dir()] by default and can be changed with option 'datasus.cache_dir'.
Compatibility
Historical 'sim_*()' and 'sinasc_nv_*()' functions remain available for existing scripts. Their public signatures are preserved; new workflows should prefer [sim()] and [sinasc()]. Network integrations are tested only by explicit or scheduled smoke tests, while regular package tests use local fixtures and mocks.
Author(s)
Maintainer: Renato Prado Siqueira rpradosiqueira@gmail.com
Authors:
Renato Prado Siqueira rpradosiqueira@gmail.com
See Also
Useful links:
Report bugs at https://github.com/rpradosiqueira/datasus/issues
Add territorial attributes to a data frame
Description
Validates a territorial code column and appends the corresponding current IBGE names and hierarchy. Six-digit DATASUS municipality codes are converted to seven-digit IBGE codes. The function does not redistribute historical observations across boundary changes.
Usage
adicionar_territorio(
dados,
codigo,
nivel = c("municipio", "uf", "regiao"),
desconhecido = c("erro", "na"),
sobrescrever = FALSE
)
Arguments
dados |
A data frame. |
codigo |
Name of the territorial code column. |
nivel |
Territorial level: '"municipio"', '"uf"' or '"regiao"'. |
desconhecido |
How to handle unknown values: '"erro"', '"na"' or '"manter"'. |
sobrescrever |
Whether existing columns with catalog names may be replaced. |
Value
'dados' with territorial columns appended.
Examples
dados <- data.frame(codmun = c("500270", "500370"), casos = c(10, 5))
adicionar_territorio(dados, "codmun")
Aggregate epidemiological indicators
Description
Aggregates numerator and denominator counts before calculating rates, proportions, ratios or case fatality. Rates use exact Poisson confidence intervals; proportions and case fatality use exact binomial intervals.
Usage
calcular_indicador(
dados,
numerador,
denominador,
grupo = NULL,
tipo = c("taxa", "proporcao", "razao", "letalidade"),
multiplicador = NULL,
confianca = NULL,
na_rm = FALSE,
zero_denominador = c("na", "erro")
)
Arguments
dados |
A non-empty data frame. |
numerador |
Name of the non-negative numerator column. |
denominador |
Name of the non-negative denominator column. |
grupo |
Optional character vector naming grouping columns. |
tipo |
Indicator type: '"taxa"', '"proporcao"', '"razao"' or '"letalidade"'. |
multiplicador |
Positive scale factor. When omitted, defaults to 100,000 for rates, 100 for proportions and case fatality, and 1 for ratios. |
confianca |
Optional confidence level. Exact intervals are available for rates, proportions and case fatality, but not for ratios. |
na_rm |
Whether rows with a missing numerator or denominator should be removed pairwise within each group. A group containing no complete row remains missing. |
zero_denominador |
How to handle zero denominators: '"na"' returns 'NA', while '"erro"' stops. |
Value
A data frame containing the grouping columns, aggregated 'numerador', aggregated 'denominador', 'indicador', and optional confidence limits.
Examples
dados <- data.frame(
ano = c(2024, 2024, 2025),
casos = c(10, 20, 15),
populacao = c(50000, 50000, 100000)
)
calcular_indicador(
dados, "casos", "populacao", grupo = "ano", tipo = "taxa"
)
Calculate crude epidemiological rates
Description
Calculates 'eventos / populacao * multiplicador' with explicit validation of counts and denominators. Missing values propagate to the result.
Usage
calcular_taxa(
eventos,
populacao,
multiplicador = 1e+05,
zero_denominador = c("na", "erro")
)
Arguments
eventos |
Non-negative event counts. |
populacao |
Non-negative population or person-time denominators. |
multiplicador |
Scale of the rate, default 100,000. |
zero_denominador |
How to handle zero denominators: '"na"' returns 'NA', while '"erro"' stops. |
Value
A numeric vector with the calculated rates.
Examples
calcular_taxa(c(10, 25), c(10000, 20000))
calcular_taxa(25, 20000, multiplicador = 1000)
Generate a Brazilian epidemiological calendar
Description
Generate a Brazilian epidemiological calendar
Usage
calendario_epidemiologico(ano)
Arguments
ano |
One epidemiological year. |
Value
A data frame with the 52 or 53 epidemiological weeks in the year.
Examples
calendario_epidemiologico(2026)
Query the National Registry of Health Establishments (CNES)
Description
Supports establishments, physical resources, human resources and health teams. Use 'datasus_catalogo("cnes")' to list the available datasets.
Usage
cnes(
conjunto = "estabelecimentos",
uf = NULL,
linha = NULL,
coluna = NULL,
conteudo = 1,
periodo = "last",
filtros = list()
)
Arguments
conjunto |
Dataset name listed by 'datasus_catalogo("sih")'. |
uf |
Two-letter state abbreviation. 'NULL' uses the Brazil form. |
linha |
Row dimension. ‘NULL' selects the form’s first dimension. |
coluna |
Column dimension. 'NULL' selects '"Não ativa"'. |
conteudo |
Measure label, raw TABNET value, or one-based index. |
periodo |
'"last"' for the latest competence, an exact period label or raw value, a four-digit year (all available competences in that year), or a vector of these values. |
filtros |
Named list of filters. Names and choices are available from [datasus_opcoes()]. |
Value
A data frame containing the TABNET result.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
cnes(uf = "MS")
cnes(
conjunto = "leitos_internacao",
uf = "MS",
periodo = "last"
)
})
options(old_options)
Complete territorial and temporal combinations
Description
Adds absent territory-period rows while protecting existing observations. By default the territorial universe is the set observed in 'dados'. Supply 'uf' to complete all current territories in one or more states, or 'territorios' for an explicit universe. If 'periodos' is omitted, the distinct periods observed in the data are used.
Usage
completar_territorios(
dados,
codigo,
periodo = NULL,
grupo = NULL,
nivel = c("municipio", "uf", "regiao"),
territorios = NULL,
uf = NULL,
periodos = NULL,
preencher = list(),
adicionar = TRUE
)
Arguments
dados |
A data frame. |
codigo |
Name of the territorial code column. |
periodo |
Optional name of the period column. |
grupo |
Optional names of grouping columns whose observed combinations must be completed separately. |
nivel |
Territorial level: '"municipio"', '"uf"' or '"regiao"'. |
territorios |
Optional vector defining the territorial universe. |
uf |
Optional state selector used to define the current territorial universe. For municipality data it includes every current municipality in the selected states. |
periodos |
Optional vector defining the period universe. |
preencher |
Named list of scalar values used only for rows created by the function, for example 'list(casos = 0)'. |
adicionar |
Whether to append current territorial attributes with [adicionar_territorio()]. |
Value
A data frame ordered by groups, territory and period.
Examples
dados <- data.frame(
codmun = c("500270", "500270", "500370"),
ano = c(2023, 2025, 2023),
casos = c(10, 12, 5)
)
completar_territorios(
dados, "codmun", "ano",
periodos = 2023:2025,
preencher = list(casos = 0)
)
List supported DATASUS datasets
Description
Returns the local catalog used by the health-services query functions. This function does not access the network.
Usage
datasus_catalogo(sistema = NULL)
Arguments
sistema |
Optional system name: '"sih"', '"sia"', '"cnes"', '"populacao"', '"sinan"', '"pni"', '"siscan"', '"sisvan"' or '"financiamento"', '"sim"' or '"sinasc"'. |
Value
A data frame with the system, dataset name, category, description and geographic form scope.
Examples
datasus_catalogo()
datasus_catalogo("cnes")
Inspect curated DATASUS field dictionaries
Description
Returns the fields currently standardized by [datasus_padronizar()]. Contemporary schemas cover the variables documented in the official ESAVI, e-SUS Notifica, PNI and hospital-occupancy dictionaries. Fields added by a source after the packaged dictionary was released remain untouched and can be detected with [datasus_validar_esquema()].
Usage
datasus_dicionario(sistema, tipo = NULL)
Arguments
sistema |
System: '"sim"', '"sinasc"', '"sih"', '"esavi"', '"sindrome_gripal"', '"pni_doses"' or '"ocupacao_hospitalar"'. |
tipo |
Optional raw file type. 'NULL' selects the default type. |
Value
A data frame with original field, standardized field, description, target class and date format.
Examples
datasus_dicionario("sim")
datasus_dicionario("sih", "RD")
Inspect the options of a DATASUS query
Description
Reads the current TABNET form and returns its row, column, measure, period and filter choices. Filter names in the returned 'filtros' list are the names accepted by the query functions.
Usage
datasus_opcoes(sistema, conjunto = NULL, uf = NULL, abrangencia = NULL)
Arguments
sistema |
System name accepted by [datasus_catalogo()]. |
conjunto |
Dataset name listed by [datasus_catalogo()]. When omitted, uses the default dataset for the system. |
uf |
State abbreviation, two-digit IBGE code or state name. When 'NULL', uses the Brazil form. |
abrangencia |
Optional geographic detail for SIM and SINASC: '"municipio"' for the nationwide municipal form or '"uf"' for the region/state form. Other systems retain their existing behavior. |
Value
An object of class 'datasus_opcoes'. Its components are data frames named 'linha', 'coluna', 'conteudo' and 'periodo', plus a named list 'filtros'.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
op <- datasus_opcoes("sih", uf = "MS")
op$conteudo
op$filtros$carater_atendimento
})
options(old_options)
Standardize common fields in DATASUS microdata
Description
Renames curated fields and converts documented dates, identifiers, numeric measures and logical indicators. Unrecognized columns and coded category values are preserved exactly as published.
Usage
datasus_padronizar(dados, sistema, tipo = NULL)
Arguments
dados |
A data frame containing raw DATASUS records. |
sistema |
System accepted by [datasus_dicionario()]. |
tipo |
Optional raw file type. 'NULL' selects the default type. |
Value
The input data frame with curated fields renamed and typed. Provenance is preserved and the applied dictionary is attached as attribute '"datasus_dicionario"'.
Examples
example <- data.frame(
MUNIC_RES = "120040",
DT_INTER = "20240110",
DIAG_PRINC = "J18"
)
datasus_padronizar(example, "sih")
Retrieve DATASUS provenance metadata
Description
Retrieve DATASUS provenance metadata
Usage
datasus_proveniencia(x)
Arguments
x |
An object returned by [opendatasus_catalogo()], [opendatasus_recursos()], [opendatasus_baixar()] or [opendatasus_ler()]. |
Value
A named list, or 'NULL' when no provenance metadata is attached.
List Brazilian territories
Description
Returns the package's offline territorial reference. The municipality table is generated from the official IBGE Localities API and contains current municipality, state, macroregion, immediate/intermediate region and legacy micro/mesoregion codes and names.
Usage
datasus_territorios(nivel = c("municipio", "uf", "regiao"), uf = NULL)
Arguments
nivel |
Territorial level: '"municipio"', '"uf"' or '"regiao"'. |
uf |
Optional state selector. It accepts a two-digit IBGE code, state abbreviation or full state name. It is available for municipality and state results. |
Value
A data frame. Source and extraction metadata are available through [datasus_proveniencia()].
Examples
datasus_territorios("regiao")
datasus_territorios("uf")
head(datasus_territorios("municipio", uf = "MS"))
Validate curated DATASUS schemas
Description
Compares the columns of a raw or standardized data frame with fields in [datasus_dicionario()]. This detects missing fields and incompatible target classes without treating newly introduced source columns as errors.
Usage
datasus_validar_esquema(
dados,
sistema,
tipo = NULL,
campos = NULL,
estrito = FALSE
)
Arguments
dados |
A data frame containing raw or standardized records. |
sistema |
System accepted by [datasus_dicionario()]. |
tipo |
Optional raw file type for SIM, SINASC or SIH. |
campos |
Optional source or standardized field names to require. 'NULL' checks every curated field for the selected system. |
estrito |
Whether missing or incompatibly typed standardized fields should raise an error. |
Value
A data frame with source and standardized field names, presence, observed column and class, expected class and status. Attribute '"campos_extras"' lists columns outside the curated dictionary.
Examples
dados <- data.frame(
dt_vacina = "2025-01-10",
co_municipio_paciente = "5002704"
)
datasus_validar_esquema(dados, "pni_doses")
Read anonymous ESAVI notifications
Description
Downloads anonymous individual records from the e-SUS Notifica ESAVI module. The source contains notifications since January 2021 and is continuously updated. An event following immunization does not by itself establish a causal association with a vaccine.
Usage
esavi(
formato = "CSV",
destino = NULL,
cache = TRUE,
atualizar = FALSE,
n_max = Inf,
colunas = NULL,
normalizar = FALSE,
...
)
Arguments
formato |
File format, '"CSV"' or '"JSON"'. |
destino |
Optional destination file or existing directory. |
cache |
Whether to reuse the local OpenDataSUS cache. |
atualizar |
Whether to force a fresh metadata query and download. |
n_max |
Maximum number of rows to read. |
colunas |
Optional character vector selecting columns during CSV parsing. |
normalizar |
Whether to apply the curated contemporary schema with [datasus_padronizar()]. |
... |
Additional arguments passed to the underlying reader. |
Value
The parsed OpenDataSUS resource with provenance metadata.
References
OpenDataSUS. ESAVI - Dados sobre Eventos Supostamente Atribuíveis a Vacinação. https://dadosabertos.saude.gov.br/dataset/esavi
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
eventos <- esavi(n_max = 1000)
datasus_proveniencia(eventos)
})
options(old_options)
Read e-SUS Notifica mild influenza-like illness records
Description
Downloads anonymous mild and moderate influenza-like illness notifications published by annual dataset and state. These records are distinct from hospitalized severe acute respiratory syndrome records returned by [sivep_gripe()].
Usage
esus_sindrome_gripal(
uf,
ano = "last",
formato = "CSV",
destino = NULL,
cache = TRUE,
atualizar = FALSE,
n_max = Inf,
colunas = NULL,
normalizar = FALSE,
...
)
Arguments
uf |
One Brazilian state abbreviation, IBGE code or state name. |
ano |
Dataset year from 2020 onwards, or '"last"' for the latest annual dataset currently published. |
formato |
File format. The annual state resources are published as '"CSV"'. |
destino |
Optional destination file or existing directory. |
cache |
Whether to reuse the local OpenDataSUS cache. |
atualizar |
Whether to force a fresh metadata query and download. |
n_max |
Maximum number of rows to read. |
colunas |
Optional character vector selecting columns during CSV parsing. |
normalizar |
Whether to apply the curated contemporary schema with [datasus_padronizar()]. |
... |
Additional arguments passed to the underlying reader. |
Value
The parsed OpenDataSUS resource with provenance metadata.
References
OpenDataSUS. Notificações de Síndrome Gripal. https://dadosabertos.saude.gov.br/dataset?query=sindrome+gripal
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
casos <- esus_sindrome_gripal(uf = "MS", ano = 2024, n_max = 1000)
})
options(old_options)
Extract IBGE codes from DATASUS labels
Description
Extracts the first territorial code embedded in labels such as '"500270 Campo Grande"' and then validates and converts it with [normalizar_codigo_ibge()].
Usage
extrair_codigo_ibge(
x,
nivel = c("municipio", "uf", "regiao"),
formato = NULL,
desconhecido = c("erro", "na", "manter")
)
Arguments
x |
Character vector containing codes or labeled values. |
nivel |
Territorial level: '"municipio"', '"uf"' or '"regiao"'. |
formato |
Output format. Municipalities support '"ibge"' (seven digits) and '"datasus"' (six digits). States and regions additionally support '"sigla"' and '"nome"'. |
desconhecido |
How to handle unknown values: '"erro"', '"na"' or '"manter"'. |
Value
A normalized character vector.
Examples
extrair_codigo_ibge(c("500270 Campo Grande", "500370 Dourados"))
Query legacy SUS financing tables
Description
Provides the three financial tables linked by the DATASUS TABNET catalog: federal resources, approved production values by provider, and payment authorization guides. Availability periods vary and may be historical.
Usage
financiamento_sus(
conjunto = "recursos_federais",
uf = NULL,
linha = NULL,
coluna = NULL,
conteudo = 1,
periodo = "last",
filtros = list()
)
Arguments
conjunto |
Dataset name listed by 'datasus_catalogo("sih")'. |
uf |
Two-letter state abbreviation. 'NULL' uses the Brazil form. |
linha |
Row dimension. ‘NULL' selects the form’s first dimension. |
coluna |
Column dimension. 'NULL' selects '"Não ativa"'. |
conteudo |
Measure label, raw TABNET value, or one-based index. |
periodo |
'"last"' for the latest competence, an exact period label or raw value, a four-digit year (all available competences in that year), or a vector of these values. |
filtros |
Named list of filters. Names and choices are available from [datasus_opcoes()]. |
Value
A data frame containing the TABNET result.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
financiamento_sus(uf = "MS")
financiamento_sus(conjunto = "producao_prestador", uf = "MS")
})
options(old_options)
Calculate exact Poisson confidence intervals for rates
Description
Uses chi-squared quantiles for exact Poisson count limits and divides them by the supplied denominator. Event counts must be whole numbers.
Usage
intervalo_taxa(
eventos,
populacao,
multiplicador = 1e+05,
confianca = 0.95,
zero_denominador = c("na", "erro")
)
Arguments
eventos |
Non-negative event counts. |
populacao |
Non-negative population or person-time denominators. |
multiplicador |
Scale of the rate, default 100,000. |
confianca |
Confidence level between 0 and 1. |
zero_denominador |
How to handle zero denominators: '"na"' returns 'NA', while '"erro"' stops. |
Value
A data frame with event counts, denominators, rates and lower and upper confidence limits.
Examples
intervalo_taxa(c(0, 10), c(10000, 10000))
Join validated population denominators
Description
Performs a many-to-one join from observations to a population table, preserving observation order and rejecting ambiguous denominator keys. This is designed to connect outputs from [populacao_residente()] to event tables before calculating population-based indicators.
Usage
juntar_populacao(
dados,
populacao,
por,
coluna_populacao = "populacao",
nome = "populacao",
ausente = c("erro", "na"),
sobrescrever = FALSE
)
Arguments
dados |
Observation data frame. |
populacao |
Population data frame. |
por |
Character vector of join columns. An unnamed vector uses the same names in both tables. In a named vector, names refer to columns in 'dados' and values to columns in 'populacao'. |
coluna_populacao |
Name of the numeric denominator column in 'populacao'. |
nome |
Name assigned to the joined denominator column. |
ausente |
How to handle observations without a denominator: '"erro"' stops and '"na"' keeps them with a missing value. |
sobrescrever |
Whether an existing 'nome' column in 'dados' may be replaced. |
Value
'dados' with one validated population denominator column appended.
Examples
eventos <- data.frame(codigo = c("A", "B"), ano = 2024, casos = c(2, 4))
denominadores <- data.frame(
municipio = c("A", "B"), ano = 2024, habitantes = c(1000, 2000)
)
juntar_populacao(
eventos, denominadores,
por = c(codigo = "municipio", ano = "ano"),
coluna_populacao = "habitantes"
)
Calculate grouped case fatality
Description
Calculate grouped case fatality
Usage
letalidade(
dados,
obitos,
casos,
grupo = NULL,
multiplicador = 100,
confianca = NULL,
na_rm = FALSE,
zero_denominador = c("na", "erro")
)
Arguments
dados |
A non-empty data frame. |
obitos |
Name of the deaths among cases column. |
casos |
Name of the cases column. |
grupo |
Optional character vector naming grouping columns. |
multiplicador |
Positive scale, default 100 for a percentage. |
confianca |
Optional confidence level. Exact intervals are available for rates, proportions and case fatality, but not for ratios. |
na_rm |
Whether rows with a missing numerator or denominator should be removed pairwise within each group. A group containing no complete row remains missing. |
zero_denominador |
How to handle zero denominators: '"na"' returns 'NA', while '"erro"' stops. |
Value
A data frame with aggregated counts and 'letalidade'.
Examples
dados <- data.frame(doenca = c("A", "A"), obitos = c(1, 2),
casos = c(20, 30))
letalidade(dados, "obitos", "casos", grupo = "doenca")
Calculate moving averages
Description
Calculate moving averages
Usage
media_movel(
x,
janela = 7L,
alinhamento = c("direita", "centro", "esquerda"),
parcial = FALSE,
na_rm = FALSE
)
Arguments
x |
Numeric vector. |
janela |
Positive window size. |
alinhamento |
Window alignment: '"direita"', '"centro"' or '"esquerda"'. |
parcial |
Whether edge windows may contain fewer than 'janela' observations. |
na_rm |
Whether missing values should be removed within each window. |
Value
A numeric vector of the same length as 'x'.
Examples
media_movel(1:7, janela = 3)
media_movel(c(1, NA, 3, 4), janela = 2, na_rm = TRUE)
Discover raw DATASUS microdata files
Description
Builds the official DATASUS transfer paths and optionally checks whether each file currently exists. SIM and SINASC files are annual; SIH files are monthly.
Usage
microdados_arquivos(
sistema,
tipo = NULL,
ano,
mes = NULL,
uf = NULL,
preliminares = TRUE,
verificar = TRUE,
timeout = 120
)
Arguments
sistema |
System: '"sim"', '"sinasc"' or '"sih"'. |
tipo |
File type returned by [microdados_catalogo()]. 'NULL' selects the default type for the system. |
ano |
One or more four-digit years. |
mes |
One or more months from 1 to 12. Required for SIH. |
uf |
One or more state abbreviations, two-digit IBGE codes or state names. Required for UF-scoped types. |
preliminares |
Whether preliminary directories may be considered. |
verificar |
Whether to verify file existence on the DATASUS server. |
timeout |
Network timeout in seconds for file discovery. |
Value
A data frame containing official file names, URLs and existence checks. Provenance records the selection and consultation time.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
microdados_arquivos("sim", ano = 2023, uf = "RR")
microdados_arquivos("sih", ano = 2024, mes = 1, uf = "AC")
})
options(old_options)
Download raw DATASUS DBC files
Description
Discovers and downloads one or more official DBC files. Downloads use a dedicated cache below option 'datasus.cache_dir'; 'atualizar = TRUE' requests a fresh copy.
Usage
microdados_baixar(
sistema,
tipo = NULL,
ano,
mes = NULL,
uf = NULL,
destino = NULL,
cache = TRUE,
atualizar = FALSE,
preliminares = TRUE,
verificar = TRUE,
timeout = 240
)
Arguments
sistema |
System: '"sim"', '"sinasc"' or '"sih"'. |
tipo |
File type returned by [microdados_catalogo()]. 'NULL' selects the default type for the system. |
ano |
One or more four-digit years. |
mes |
One or more months from 1 to 12. Required for SIH. |
uf |
One or more state abbreviations, two-digit IBGE codes or state names. Required for UF-scoped types. |
destino |
Optional destination directory. 'NULL' uses the package cache, or a session temporary directory when 'cache = FALSE'. |
cache |
Whether to reuse the disk cache. |
atualizar |
Whether to request a fresh copy of already cached files. |
preliminares |
Whether preliminary directories may be considered. |
verificar |
Whether to verify file existence on the DATASUS server. |
timeout |
Network timeout in seconds for file discovery. |
Value
A data frame describing the local files. Use [datasus_proveniencia()] for URLs and checksums.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
files <- microdados_baixar("sih", ano = 2024, mes = 1, uf = "AC")
datasus_proveniencia(files)
})
options(old_options)
List supported DATASUS microdata files
Description
Returns the local catalog of raw DBC/DBF file families supported by the package. These files provide record-level data, unlike aggregated TABNET results.
Usage
microdados_catalogo(sistema = NULL)
Arguments
sistema |
Optional system: '"sim"', '"sinasc"' or '"sih"'. |
Value
A data frame with system, upstream source, file type, description, geographic scope and frequency.
Examples
microdados_catalogo()
microdados_catalogo("sih")
Download and read raw DATASUS microdata
Description
Downloads the requested DBC files and reads them directly in memory using the native 'datasusr' decoder. Column selection and 'n_max' are applied during parsing, which is useful for large SIH files.
Usage
microdados_ler(
sistema,
tipo = NULL,
ano,
mes = NULL,
uf = NULL,
destino = NULL,
cache = TRUE,
atualizar = FALSE,
preliminares = TRUE,
verificar = TRUE,
timeout = 240,
colunas = NULL,
n_max = Inf,
normalizar = FALSE,
juntar = TRUE,
...
)
Arguments
sistema |
System: '"sim"', '"sinasc"' or '"sih"'. |
tipo |
File type returned by [microdados_catalogo()]. 'NULL' selects the default type for the system. |
ano |
One or more four-digit years. |
mes |
One or more months from 1 to 12. Required for SIH. |
uf |
One or more state abbreviations, two-digit IBGE codes or state names. Required for UF-scoped types. |
destino |
Optional destination directory. 'NULL' uses the package cache, or a session temporary directory when 'cache = FALSE'. |
cache |
Whether to reuse the disk cache. |
atualizar |
Whether to request a fresh copy of already cached files. |
preliminares |
Whether preliminary directories may be considered. |
verificar |
Whether to verify file existence on the DATASUS server. |
timeout |
Network timeout in seconds for file discovery. |
colunas |
Optional vector of original or lower-case columns to read. |
n_max |
Maximum number of records to read from each file. |
normalizar |
Whether to rename and type common fields with [datasus_padronizar()]. |
juntar |
Whether to combine multiple files. If 'FALSE', returns a named list. |
... |
Additional arguments passed to [datasusr::read_datasus_dbc()]. |
Value
A data frame, or a named list when 'juntar = FALSE', with provenance metadata attached.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
admissions <- microdados_ler(
"sih",
ano = 2024,
mes = 1,
uf = "AC",
colunas = c("MUNIC_RES", "DT_INTER", "DIAG_PRINC", "VAL_TOT"),
n_max = 1000,
normalizar = TRUE
)
})
options(old_options)
Normalize IBGE territorial codes
Description
Validates current territorial identifiers against the bundled IBGE reference. Municipality inputs may use the full seven-digit IBGE code or the six-digit form commonly returned by DATASUS. State and region inputs may also use abbreviations or full names.
Usage
normalizar_codigo_ibge(
codigo,
nivel = c("municipio", "uf", "regiao"),
formato = NULL,
desconhecido = c("erro", "na", "manter")
)
Arguments
codigo |
Vector of territorial identifiers. |
nivel |
Territorial level: '"municipio"', '"uf"' or '"regiao"'. |
formato |
Output format. Municipalities support '"ibge"' (seven digits) and '"datasus"' (six digits). States and regions additionally support '"sigla"' and '"nome"'. |
desconhecido |
How to handle unknown values: '"erro"', '"na"' or '"manter"'. |
Value
A character vector with the same length as 'codigo'.
Examples
normalizar_codigo_ibge(c("500270", "5003702"))
normalizar_codigo_ibge(c("MS", "Mato Grosso do Sul"), "uf", "ibge")
Read COVID-19 hospital occupancy records
Description
Downloads annual records from the e-SUS Notifica Hospital Admissions module. The published files cover SUS clinical and intensive-care beds allocated to suspected or confirmed COVID-19 cases. Fields added in 2022 are not populated in earlier records.
Usage
ocupacao_hospitalar(
ano = "last",
formato = "CSV",
destino = NULL,
cache = TRUE,
atualizar = FALSE,
n_max = Inf,
colunas = NULL,
normalizar = FALSE,
...
)
Arguments
ano |
Resource year or '"last"' for the latest year currently published. |
formato |
File format, '"CSV"' or '"JSON"'. |
destino |
Optional destination file or existing directory. |
cache |
Whether to reuse the local OpenDataSUS cache. |
atualizar |
Whether to force a fresh metadata query and download. |
n_max |
Maximum number of rows to read. |
colunas |
Optional character vector selecting columns during CSV parsing. |
normalizar |
Whether to apply the curated contemporary schema with [datasus_padronizar()]. |
... |
Additional arguments passed to the underlying reader. |
Value
The parsed OpenDataSUS resource with provenance metadata.
References
OpenDataSUS. Registro de Ocupação Hospitalar COVID-19. https://dadosabertos.saude.gov.br/dataset/registro-de-ocupacao-hospitalar-covid-19
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
leitos <- ocupacao_hospitalar(ano = 2022, n_max = 1000)
})
options(old_options)
Expand downloadable files from OpenDataSUS resources
Description
Some OpenDataSUS resources, notably state-level influenza-like illness datasets, publish several file parts as links inside the resource description instead of the primary URL field. This function expands both representations to one row per downloadable file.
Usage
opendatasus_arquivos(
conjunto,
recurso = NULL,
formato = NULL,
cache = TRUE,
atualizar = FALSE
)
Arguments
conjunto |
Dataset slug returned by [opendatasus_catalogo()]. |
recurso |
Optional exact resource name or identifier. |
formato |
Optional resource format. |
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. |
Value
A data frame with one row per downloadable file and its parent resource identifier, part number and URL.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
opendatasus_arquivos(
"notificacoes-de-sindrome-gripal-leve-2024",
recurso = "Dados MS - 20/12",
formato = "CSV"
)
})
options(old_options)
Download a resource from OpenDataSUS
Description
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.
Usage
opendatasus_baixar(
conjunto,
recurso = NULL,
ano = "last",
formato = NULL,
destino = NULL,
cache = TRUE,
atualizar = FALSE
)
Arguments
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. |
Value
The normalized local file path, with classes '"datasus_arquivo"' and '"character"'. Use [datasus_proveniencia()] to inspect its origin.
Examples
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)
Search the OpenDataSUS catalog
Description
Searches the current OpenDataSUS portal and returns lightweight metadata for matching datasets. Use [opendatasus_recursos()] to inspect the files and API links published for one dataset.
Usage
opendatasus_catalogo(
busca = NULL,
grupo = NULL,
formato = NULL,
pagina = 1L,
limite = 20L,
cache = TRUE,
atualizar = FALSE
)
Arguments
busca |
Optional free-text search. |
grupo |
Optional OpenDataSUS group slug. |
formato |
Optional resource format, such as '"CSV"', '"JSON"' or '"PDF"'. |
pagina |
Positive page number. |
limite |
Number of results requested per page. |
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. |
Value
A data frame with dataset names, titles, descriptions, formats and groups. Attribute '"datasus_proveniencia"' records the source and consultation time.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
opendatasus_catalogo("dengue")
opendatasus_catalogo(grupo = "arboviroses", formato = "CSV")
})
options(old_options)
Download and read tabular OpenDataSUS data
Description
Selects and downloads one CSV or JSON resource, then reads it into R. CSV delimiters are detected automatically. For very large datasets, use 'n_max' while exploring the columns, or call [opendatasus_baixar()] and use a streaming database engine.
Usage
opendatasus_ler(
conjunto,
recurso = NULL,
ano = "last",
formato = NULL,
destino = NULL,
cache = TRUE,
atualizar = FALSE,
n_max = Inf,
colunas = NULL,
...
)
Arguments
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. |
n_max |
Maximum number of CSV rows to read. For JSON data, the limit is applied after parsing when the result is a data frame. |
colunas |
Optional character vector selecting columns while CSV files are parsed. JSON columns are selected after parsing. |
... |
Additional arguments passed to [readr::read_delim()] or [jsonlite::fromJSON()]. |
Value
The parsed resource. Attribute '"datasus_proveniencia"' records the selected resource, download time, local file and checksum.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
dengue <- opendatasus_ler(
"arboviroses-dengue",
ano = 2025,
formato = "CSV",
n_max = 1000
)
datasus_proveniencia(dengue)
})
options(old_options)
Process large OpenDataSUS CSV resources in chunks
Description
Downloads the selected resource using the regular atomic cache, expands multipart resources, and invokes a callback for bounded-size chunks. Returning small summaries or 'NULL' from the callback keeps memory use independent of the complete dataset size.
Usage
opendatasus_processar(
conjunto,
FUN,
recurso = NULL,
ano = "last",
formato = "CSV",
destino = NULL,
cache = TRUE,
atualizar = FALSE,
colunas = NULL,
tamanho_bloco = 100000L,
sistema = NULL,
...
)
Arguments
conjunto |
Dataset slug returned by [opendatasus_catalogo()]. |
FUN |
Function called as 'FUN(dados, posicao, arquivo)', where 'posicao' is the first row position within a file and 'arquivo' is the one-based file-part index. |
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. |
colunas |
Optional character vector selecting columns while CSV files are parsed. JSON columns are selected after parsing. |
tamanho_bloco |
Positive number of rows parsed per chunk. |
sistema |
Optional dictionary system accepted by [datasus_padronizar()]. When supplied, each chunk is standardized before 'FUN' is called. |
... |
Additional arguments passed to [readr::read_delim()] or [jsonlite::fromJSON()]. |
Value
An object of class '"datasus_processamento"' containing callback results, row, chunk and file counts, and provenance for every file.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
summary <- opendatasus_processar(
"doses-aplicadas-pelo-programa-de-nacional-de-imunizacoes-pni-2026",
recurso = "Vacinação - Julho 2026",
ano = NULL,
formato = "CSV",
FUN = function(dados, posicao, arquivo) nrow(dados),
tamanho_bloco = 50000
)
})
options(old_options)
List resources from an OpenDataSUS dataset
Description
List resources from an OpenDataSUS dataset
Usage
opendatasus_recursos(conjunto, cache = TRUE, atualizar = FALSE)
Arguments
conjunto |
Dataset slug returned by [opendatasus_catalogo()]. |
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. |
Value
A data frame with one row per published resource, including its stable identifier, name, format, inferred year, URL and update date.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
opendatasus_recursos("srag-2019-a-2026")
opendatasus_recursos("arboviroses-dengue")
})
options(old_options)
Directly standardize rates by age
Description
Calculates a weighted average of age-specific rates using a supplied standard population. Independent Poisson counts are assumed for the standard error. Optional confidence limits use a normal approximation.
Usage
padronizar_idade(
eventos,
populacao,
idade,
populacao_padrao,
grupo = NULL,
multiplicador = 1e+05,
confianca = NULL,
na_rm = FALSE
)
Arguments
eventos |
Non-negative event counts by age stratum. |
populacao |
Positive population or person-time by age stratum. |
idade |
Age-stratum labels. |
populacao_padrao |
Standard population weights. Supply either one value per input row or a named vector whose names match 'idade'. |
grupo |
Optional analysis group, such as year or municipality. Each age stratum must occur at most once within a group. |
multiplicador |
Scale of the standardized rate, default 100,000. |
confianca |
Optional confidence level. 'NULL' omits confidence limits. |
na_rm |
Whether incomplete age strata should be removed and the remaining standard weights renormalized. |
Value
A data frame with standardized rate, standard error, confidence limits, number of strata and proportion of standard weight represented.
References
Ahmad OB et al. (2001). Age standardization of rates: a new WHO standard. World Health Organization.
Examples
padronizar_idade(
eventos = c(10, 40),
populacao = c(1000, 1000),
idade = c("0-49", "50+"),
populacao_padrao = c("0-49" = 800, "50+" = 200)
)
Read individual PNI dose records
Description
Downloads anonymous vaccination records published in monthly files by the National Immunization Program. This record-level source complements the aggregated historical TABNET series returned by [pni_imunizacoes()].
Usage
pni_doses(
ano = "last",
mes = "last",
formato = "CSV",
destino = NULL,
cache = TRUE,
atualizar = FALSE,
n_max = Inf,
colunas = NULL,
normalizar = FALSE,
...
)
Arguments
ano |
Dataset year from 2020 onwards, or '"last"' for the most recent annual dataset currently published. |
mes |
Month number, Portuguese month name, or '"last"' for the latest month currently published in the selected year and format. |
formato |
File format, '"CSV"' or '"JSON"'. |
destino |
Optional destination file or existing directory. |
cache |
Whether to reuse the local OpenDataSUS cache. |
atualizar |
Whether to force a fresh metadata query and download. |
n_max |
Maximum number of rows to read. |
colunas |
Optional character vector selecting columns during CSV parsing. |
normalizar |
Whether to apply the curated contemporary schema with [datasus_padronizar()]. |
... |
Additional arguments passed to the underlying reader. |
Value
The parsed OpenDataSUS resource with provenance metadata.
References
OpenDataSUS. Doses aplicadas pelo Programa Nacional de Imunizações. https://dadosabertos.saude.gov.br/dataset?query=doses+aplicadas+PNI
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
doses <- pni_doses(ano = 2025, mes = 1, n_max = 1000)
})
options(old_options)
Query legacy immunization data from PNI
Description
Provides applied doses and vaccination coverage from the legacy TABNET series, whose latest available year is currently 2022. DATASUS reports that coverage and applied-dose data are under review for integration inconsistencies.
Usage
pni_imunizacoes(
conjunto = "doses_aplicadas",
uf = NULL,
linha = NULL,
coluna = NULL,
conteudo = 1,
periodo = "last",
filtros = list()
)
Arguments
conjunto |
Dataset name listed by 'datasus_catalogo("sih")'. |
uf |
Two-letter state abbreviation. 'NULL' uses the Brazil form. |
linha |
Row dimension. ‘NULL' selects the form’s first dimension. |
coluna |
Column dimension. 'NULL' selects '"Não ativa"'. |
conteudo |
Measure label, raw TABNET value, or one-based index. |
periodo |
'"last"' for the latest competence, an exact period label or raw value, a four-digit year (all available competences in that year), or a vector of these values. |
filtros |
Named list of filters. Names and choices are available from [datasus_opcoes()]. |
Value
A data frame containing the TABNET result.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
pni_imunizacoes(uf = "MS")
pni_imunizacoes(
conjunto = "cobertura",
uf = "MS",
periodo = 2022
)
})
options(old_options)
Retrieve ready-made standard populations
Description
Returns age-group weights for the WHO 2000–2025 world standard, Segi's world standard or the Scandinavian standard. By default weights are normalized to sum to one and can be passed directly to [padronizar_idade()].
Usage
populacao_padrao(
nome = "oms_2000_2025",
formato = c("vetor", "dados"),
normalizar = TRUE
)
Arguments
nome |
Standard population: '"oms_2000_2025"', '"segi"' or '"escandinava"'. '"oms"' and '"who"' are accepted aliases. |
formato |
Output as a named numeric '"vetor"' or a data frame ('"dados"'). |
normalizar |
Whether weights should be normalized to sum to one. |
Value
A named numeric vector or a data frame with 'faixa_etaria', 'peso_publicado' and 'peso'.
References
Ahmad OB et al. (2001). Age standardization of rates: a new WHO standard. https://cdn.who.int/media/docs/default-source/gho-documents/global-health-estimates/gpe_discussion_paper_series_paper31_2001_age_standardization_rates.pdf
Examples
populacao_padrao("oms")
populacao_padrao("segi", formato = "dados")
Query resident population estimates
Description
Provides census, projection, retroprojection and municipal estimate datasets published in the DATASUS population section. The default dataset contains municipal estimates by sex and age from 2000 through 2021.
Usage
populacao_residente(
conjunto = "estimativa_municipal",
uf = NULL,
linha = NULL,
coluna = NULL,
conteudo = 1,
periodo = "last",
filtros = list()
)
Arguments
conjunto |
Dataset name listed by 'datasus_catalogo("sih")'. |
uf |
Two-letter state abbreviation. 'NULL' uses the Brazil form. |
linha |
Row dimension. ‘NULL' selects the form’s first dimension. |
coluna |
Column dimension. 'NULL' selects '"Não ativa"'. |
conteudo |
Measure label, raw TABNET value, or one-based index. |
periodo |
'"last"' for the latest competence, an exact period label or raw value, a four-digit year (all available competences in that year), or a vector of these values. |
filtros |
Named list of filters. Names and choices are available from [datasus_opcoes()]. |
Value
A data frame containing the TABNET result.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
populacao_residente(uf = "MS", periodo = 2021)
populacao_residente(
linha = "Unidade da Federação",
periodo = c(2020, 2021)
)
})
options(old_options)
Calculate grouped proportions
Description
Calculate grouped proportions
Usage
proporcao(
dados,
parte,
total,
grupo = NULL,
multiplicador = 100,
confianca = NULL,
na_rm = FALSE,
zero_denominador = c("na", "erro")
)
Arguments
dados |
A non-empty data frame. |
parte |
Name of the subset count column. |
total |
Name of the total count column. |
grupo |
Optional character vector naming grouping columns. |
multiplicador |
Positive scale, default 100 for a percentage. |
confianca |
Optional confidence level. Exact intervals are available for rates, proportions and case fatality, but not for ratios. |
na_rm |
Whether rows with a missing numerator or denominator should be removed pairwise within each group. A group containing no complete row remains missing. |
zero_denominador |
How to handle zero denominators: '"na"' returns 'NA', while '"erro"' stops. |
Value
A data frame with aggregated counts and 'proporcao'.
Examples
dados <- data.frame(ano = c(2024, 2024), vacinados = c(40, 45),
elegiveis = c(50, 50))
proporcao(dados, "vacinados", "elegiveis", grupo = "ano")
Convert dates to Brazilian epidemiological weeks
Description
Epidemiological weeks run from Sunday through Saturday. Week 1 is the Sunday-to-Saturday week containing at least four days of the new year. Dates near New Year can therefore belong to the previous or following epidemiological year.
Usage
semana_epidemiologica(data)
Arguments
data |
A 'Date', date-time, or vector of ISO '"YYYY-MM-DD"' strings. |
Value
A data frame containing the original date, epidemiological year and week, week start and end, and a stable '"YYYY-Www"' code.
References
Brazilian Ministry of Health, SINAN Epidemiological Calendar: https://portalsinan.saude.gov.br/calendario-epidemiologico
Examples
semana_epidemiologica(as.Date(c("2025-01-01", "2026-01-01")))
Query ambulatory production from SIA/SUS
Description
Query ambulatory production from SIA/SUS
Usage
sia_producao(
conjunto = "atendimento",
uf = NULL,
linha = NULL,
coluna = NULL,
conteudo = 1,
periodo = "last",
filtros = list()
)
Arguments
conjunto |
Dataset name listed by 'datasus_catalogo("sih")'. |
uf |
Two-letter state abbreviation. 'NULL' uses the Brazil form. |
linha |
Row dimension. ‘NULL' selects the form’s first dimension. |
coluna |
Column dimension. 'NULL' selects '"Não ativa"'. |
conteudo |
Measure label, raw TABNET value, or one-based index. |
periodo |
'"last"' for the latest competence, an exact period label or raw value, a four-digit year (all available competences in that year), or a vector of these values. |
filtros |
Named list of filters. Names and choices are available from [datasus_opcoes()]. |
Value
A data frame containing the TABNET result.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
sia_producao(uf = "MS")
sia_producao(
linha = "UF",
conteudo = "Qtd.aprovada",
periodo = "last"
)
})
options(old_options)
Read SIH hospitalization microdata
Description
Read SIH hospitalization microdata
Usage
sih_microdados(ano, mes, uf, tipo = "RD", ...)
Arguments
ano |
One or more years. |
mes |
One or more months. |
uf |
One or more state abbreviations. |
tipo |
SIH file type, default '"RD"'. |
... |
Additional arguments passed to [microdados_ler()]. |
Value
Record-level SIH data.
Query hospital morbidity from SIH/SUS
Description
Provides general morbidity and external-causes views by place of hospitalization or residence. Use 'datasus_catalogo("sih")' and select rows whose category is '"morbidade hospitalar"' to list the datasets.
Usage
sih_morbidade(
conjunto = "geral_internacao",
uf = NULL,
linha = NULL,
coluna = NULL,
conteudo = 1,
periodo = "last",
filtros = list()
)
Arguments
conjunto |
Dataset name listed by 'datasus_catalogo("sih")'. |
uf |
Two-letter state abbreviation. 'NULL' uses the Brazil form. |
linha |
Row dimension. ‘NULL' selects the form’s first dimension. |
coluna |
Column dimension. 'NULL' selects '"Não ativa"'. |
conteudo |
Measure label, raw TABNET value, or one-based index. |
periodo |
'"last"' for the latest competence, an exact period label or raw value, a four-digit year (all available competences in that year), or a vector of these values. |
filtros |
Named list of filters. Names and choices are available from [datasus_opcoes()]. |
Value
A data frame containing the TABNET result.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
sih_morbidade(uf = "MS")
sih_morbidade(
uf = "MS",
linha = "Capítulo CID-10",
conteudo = "Internações",
periodo = 2025
)
})
options(old_options)
Query hospital production from SIH/SUS
Description
Query hospital production from SIH/SUS
Usage
sih_producao(
conjunto = "aih_rd_internacao",
uf = NULL,
linha = NULL,
coluna = NULL,
conteudo = 1,
periodo = "last",
filtros = list()
)
Arguments
conjunto |
Dataset name listed by 'datasus_catalogo("sih")'. |
uf |
Two-letter state abbreviation. 'NULL' uses the Brazil form. |
linha |
Row dimension. ‘NULL' selects the form’s first dimension. |
coluna |
Column dimension. 'NULL' selects '"Não ativa"'. |
conteudo |
Measure label, raw TABNET value, or one-based index. |
periodo |
'"last"' for the latest competence, an exact period label or raw value, a four-digit year (all available competences in that year), or a vector of these values. |
filtros |
Named list of filters. Names and choices are available from [datasus_opcoes()]. |
Value
A data frame containing the TABNET result.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
sih_producao(uf = "MS")
sih_producao(
uf = "MS",
linha = "Município",
conteudo = "Internações",
periodo = 2025,
filtros = list(carater_atendimento = "Urgência")
)
})
options(old_options)
Query mortality data from SIM
Description
Provides a single interface to the mortality tables of the Mortality Information System (SIM). Available datasets are listed by 'datasus_catalogo("sim")'; current row, column, measure, period and filter choices can be inspected with 'datasus_opcoes("sim", ...)'.
Usage
sim(
conjunto = "obitos",
abrangencia = c("municipio", "uf"),
uf = NULL,
linha = NULL,
coluna = NULL,
conteudo = 1,
periodo = "last",
filtros = list()
)
Arguments
conjunto |
SIM dataset: '"obitos"', '"mortalidade_infantil"', '"causas_evitaveis_0_4"' or '"causas_evitaveis_5_74"'. |
abrangencia |
Geographic form: '"municipio"' for municipality-level results or '"uf"' for region/state-level results. |
uf |
Optional state abbreviation, two-digit IBGE code or state name. With 'abrangencia = "municipio"', selects the state-specific municipal form. It must be 'NULL' with 'abrangencia = "uf"'. |
linha |
Row dimension. ‘NULL' selects the form’s first dimension. |
coluna |
Column dimension. 'NULL' selects '"Não ativa"'. |
conteudo |
Measure label, raw TABNET value or one-based index. |
periodo |
'"last"' for the latest available year, an exact period label or raw value, a four-digit year, or a vector of these values. |
filtros |
Named list of filters. Use [datasus_opcoes()] to inspect their names and accepted values. |
Value
A data frame containing the TABNET result, with query provenance available through [datasus_proveniencia()].
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
datasus_catalogo("sim")
op <- datasus_opcoes(
"sim", "obitos", abrangencia = "uf"
)
obitos <- sim(
conjunto = "obitos",
abrangencia = "uf",
periodo = 2024,
filtros = list(sexo = "Masculino")
)
})
options(old_options)
Scrapes SIM's ICD-10 evitale causes data from regions
Description
This function allows the user to retrieve data from SIM's ICD-10 database much in the same way that is done by the online portal. The argument options refer to evitable causes data focused on the regions and states.
Usage
sim_evita10_bruf(linha = "Região", coluna = "Não ativa",
conteudo = 1, periodo = "last", regiao = "all", unidade_da_federacao = "all",
causas_evitaveis = "all", capitulo_cid10 = "all", categoria_cid10 = "all",
faixa_etaria = "all", sexo = "all", cor_raca = "all", escolaridade = "all",
estado_civil = "all", local_ocorrencia = "all")
Arguments
linha |
A character describing which element will be displayed in the rows of the data.frame. Defaults to "Regiãoo". |
coluna |
A character describing which element will be displayed in the columns of the data.frame. Defaults to "Nãoo ativa". |
conteudo |
A character of length = 1 with the state's acronym of interest. |
periodo |
A character vector describing the period of data. Defaults to the last available. |
regiao |
"all" or a numeric vector with the IBGE's region codes to filter the data. Defaults to "all". |
unidade_da_federacao |
"all" or a numeric vector with the IBGE's state codes to filter the data. Defaults to "all". |
causas_evitaveis |
"all" or a character vector with the evitable cause code (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
capitulo_cid10 |
"all" or a numeric vector with the ICD-10 chapter to filter the data. Defaults to "all". |
categoria_cid10 |
"all" or a character vector with the ICD-10 category codes (capital letter and two numbers) to filter the data. Defaults to "all". |
faixa_etaria |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
sexo |
"all" or a character vector with the gender (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
cor_raca |
"all" or a character vector with the color/race (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
escolaridade |
"all" or a character vector with the instruction (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
estado_civil |
"all" or a character vector with the marital status (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
local_ocorrencia |
"all" or a character vector with the place of ocurrence to filter the data. Defaults to "all". |
Value
The function returns a data frame printed by parameters input.
Lifecycle
This function is deprecated. Use 'sim()' or 'sinasc()' with a named 'filtros' list. The legacy signature is retained for compatibility.
Author(s)
Renato Prado Siqueira rpradosiqueira@gmail.com
See Also
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
## Requesting data from Midwest region
sim_evita10_bruf(regiao = 5)
})
options(old_options)
Scrapes SIM's ICD-10 evitable causes data from cities
Description
This function allows the user to retrieve data from SIM's ICD-10 database much in the same way that is done by the online portal. The argument options refer to evitable causes data focused on brazilian cities.
Usage
sim_evita10_mun(linha = "Município", coluna = "Não ativa",
conteudo = 1, periodo = "last", municipio = "all", capital = "all",
cir = "all", macrorregiao_de_saude = "all", microrregiao_ibge = "all",
ride = "all", territorio_da_cidadania = "all", mesorregiao_pndr = "all",
amazonia_legal = "all", semiarido = "all", faixa_de_fronteira = "all",
zona_de_fronteira = "all", municipio_de_extrema_pobreza = "all",
causas_evitaveis = "all", capitulo_cid10 = "all", categoria_cid10 = "all",
faixa_etaria = "all", sexo = "all", cor_raca = "all", escolaridade = "all",
estado_civil = "all", local_ocorrencia = "all")
Arguments
linha |
A character describing which element will be displayed in the rows of the data.frame. Defaults to "Município". |
coluna |
A character describing which element will be displayed in the columns of the data.frame. Defaults to "Não ativa". |
conteudo |
A character of length = 1 with the state's acronym of interest. |
periodo |
A character vector describing the period of data. Defaults to the last available. |
municipio |
"all" or a numeric vector with the IBGE's city codes codes to filter the data. Defaults to "all". |
capital |
"all" or a numeric vector with the IBGE's cities codes to filter the data. Defaults to "all". |
cir |
"all" or a numeric vector with the CIR's codes to filter the data. Defaults to "all". |
macrorregiao_de_saude |
"all" or a numeric vector with the Health macro-region's codes to filter the data. Defaults to "all". |
microrregiao_ibge |
"all" or a numeric vector with the IBGE's micro-region codes to filter the data. Defaults to "all". |
ride |
"all" or a numeric vector with the IBGE's metropolitan-region codes to filter the data. Defaults to "all". |
territorio_da_cidadania |
"all" or a numeric vector with the territory of citizenship codes to filter the data. Defaults to "all". |
mesorregiao_pndr |
"all" or a numeric vector with the PNDR's mesoregion codes to filter the data. Defaults to "all". |
amazonia_legal |
"all" or a character ("Sim" or "Não") indicating if only the Legal Amazon region must be included. Defaults to "all". |
semiarido |
"all" or a character ("Sim" or "Não") indicating if only the semiarid region must be included. Defaults to "all". |
faixa_de_fronteira |
"all" or a character ("Sim" or "Não") indicating if only the border area must be included. Defaults to "all". |
zona_de_fronteira |
"all" or a character ("Sim" or "Não") indicating if only the border strip must be included. Defaults to "all". |
municipio_de_extrema_pobreza |
"all" or a character ("Sim" or "Não") indicating if only the municipalities of extreme poverty must be included. Defaults to "all". |
causas_evitaveis |
"all" or a character vector with the evitable cause code (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
capitulo_cid10 |
"all" or a numeric vector with the ICD-10 chapter to filter the data. Defaults to "all". |
categoria_cid10 |
"all" or a character vector with the ICD-10 category codes (capital letter and two numbers) to filter the data. Defaults to "all". |
faixa_etaria |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
sexo |
"all" or a character vector with the gender (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
cor_raca |
"all" or a character vector with the color/race (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
escolaridade |
"all" or a character vector with the instruction (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
estado_civil |
"all" or a character vector with the marital status (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
local_ocorrencia |
"all" or a character vector with the place of ocurrence to filter the data. Defaults to "all". |
Value
The function returns a data frame printed by parameters input.
Lifecycle
This function is deprecated. Use 'sim()' or 'sinasc()' with a named 'filtros' list. The legacy signature is retained for compatibility.
Author(s)
Renato Prado Siqueira rpradosiqueira@gmail.com
See Also
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
## Requesting data from the city of Campo Grande/MS
sim_evita10_mun(municipio = 500270)
})
options(old_options)
Scrapes SIM's ICD-10 evitable causes data from ufs
Description
This function allows the user to retrive data from SIM's ICD-10 database much in the same way that is done by the online portal. The argument options refer to evitable causes in 0-4 age group data from the states unities.
Usage
sim_evita10_uf(uf, linha = "Município", coluna = "Não ativa",
conteudo = 1, periodo = "last", municipio = "all", cir = "all",
macrorregiao_de_saude = "all", divisao_admnist_estadual = "all",
microrregiao_ibge = "all", ride = "all", causas_evitaveis = "all",
capitulo_cid10 = "all", categoria_cid10 = "all", faixa_etaria = "all",
sexo = "all", cor_raca = "all", escolaridade = "all", estado_civil = "all",
local_ocorrencia = "all")
Arguments
uf |
A character of length = 1 with the state's acronym of interest. |
linha |
A character describing which element will be displayed in the rows of the data.frame. Defaults to "Município". |
coluna |
A character describing which element will be displayed in the columns of the data.frame. Defaults to "Não ativa". |
conteudo |
A character of length = 1 with the state's acronym of interest. |
periodo |
A character vector describing the period of data. Defaults to the last available. |
municipio |
"all" or a numeric vector with the IBGE's city codes codes to filter the data. Defaults to "all". |
cir |
"all" or a numeric vector with the CIR's codes to filter the data. Defaults to "all". |
macrorregiao_de_saude |
"all" or a numeric vector with the Health macro-region's codes to filter the data. Defaults to "all". |
divisao_admnist_estadual |
"all" or a numeric vector with the State administrative division's codes to filter the data. Defaults to "all". |
microrregiao_ibge |
"all" or a numeric vector with the IBGE's micro-region codes to filter the data. Defaults to "all". |
ride |
"all" or a numeric vector with the IBGE's metropolitan-region codes to filter the data. Defaults to "all". |
causas_evitaveis |
"all" or a character vector with the evitable cause code (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
capitulo_cid10 |
"all" or a numeric vector with the ICD-10 chapter to filter the data. Defaults to "all". |
categoria_cid10 |
"all" or a character vector with the ICD-10 category codes (capital letter and two numbers) to filter the data. Defaults to "all". |
faixa_etaria |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
sexo |
"all" or a character vector with the gender (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
cor_raca |
"all" or a character vector with the color/race (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
escolaridade |
"all" or a character vector with the instruction (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
estado_civil |
"all" or a character vector with the marital status (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
local_ocorrencia |
"all" or a character vector with the place of ocurrence to filter the data. Defaults to "all". |
Value
The function returns a data frame printed by parameters input.
Lifecycle
This function is deprecated. Use 'sim()' or 'sinasc()' with a named 'filtros' list. The legacy signature is retained for compatibility.
Author(s)
Renato Prado Siqueira rpradosiqueira@gmail.com
See Also
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
## Requesting data from the state of Mato Grosso do Sul
sim_evita10_uf(uf = "ms")
})
options(old_options)
Scrapes SIM's ICD-10 evitale causes data from regions
Description
This function allows the user to retrieve data from SIM's ICD-10 database much in the same way that is done by the online portal. The argument options refer to evitable causes data focused on the regions and states and age ranging between 5-74 years old.
Usage
sim_evitb10_bruf(linha = "Região", coluna = "Não ativa",
conteudo = 1, periodo = "last", regiao = "all", unidade_da_federacao = "all",
causas_evitaveis = "all", capitulo_cid10 = "all", categoria_cid10 = "all",
faixa_etaria = "all", faixa_etaria_detalhada = "all", sexo = "all",
cor_raca = "all", escolaridade = "all", estado_civil = "all",
local_ocorrencia = "all")
Arguments
linha |
A character describing which element will be displayed in the rows of the data.frame. Defaults to "Região". |
coluna |
A character describing which element will be displayed in the columns of the data.frame. Defaults to "Não ativa". |
conteudo |
A character of length = 1 with the state's acronym of interest. |
periodo |
A character vector describing the period of data. Defaults to the last available. |
regiao |
"all" or a numeric vector with the IBGE's region codes to filter the data. Defaults to "all". |
unidade_da_federacao |
"all" or a numeric vector with the IBGE's state codes to filter the data. Defaults to "all". |
causas_evitaveis |
"all" or a character vector with the evitable cause code (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
capitulo_cid10 |
"all" or a numeric vector with the ICD-10 chapter to filter the data. Defaults to "all". |
categoria_cid10 |
"all" or a character vector with the ICD-10 category codes (capital letter and two numbers) to filter the data. Defaults to "all". |
faixa_etaria |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_detalhada |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
sexo |
"all" or a character vector with the gender (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
cor_raca |
"all" or a character vector with the color/race (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
escolaridade |
"all" or a character vector with the instruction (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
estado_civil |
"all" or a character vector with the marital status (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
local_ocorrencia |
"all" or a character vector with the place of ocurrence to filter the data. Defaults to "all". |
Value
The function returns a data frame printed by parameters input.
Lifecycle
This function is deprecated. Use 'sim()' or 'sinasc()' with a named 'filtros' list. The legacy signature is retained for compatibility.
Author(s)
Renato Prado Siqueira rpradosiqueira@gmail.com
See Also
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
## Requesting data from Midwest region
sim_evitb10_bruf(region = 5)
})
options(old_options)
Scrapes SIM's ICD-10 evitable causes data from cities
Description
This function allows the user to retrieve data from SIM's ICD-10 database much in the same way that is done by the online portal. The argument options refer to evitable causes data focused on brazilian cities and age ranging between 5-74 years old.
Usage
sim_evitb10_mun(linha = "Município", coluna = "Não ativa",
conteudo = 1, periodo = "last", municipio = "all", capital = "all",
cir = "all", macrorregiao_de_saude = "all", microrregiao_ibge = "all",
ride = "all", territorio_da_cidadania = "all", mesorregiao_pndr = "all",
amazonia_legal = "all", semiarido = "all", faixa_de_fronteira = "all",
zona_de_fronteira = "all", municipio_de_extrema_pobreza = "all",
causas_evitaveis = "all", capitulo_cid10 = "all", categoria_cid10 = "all",
faixa_etaria = "all", faixa_etaria_detalhada = "all", sexo = "all",
cor_raca = "all", escolaridade = "all", estado_civil = "all",
local_ocorrencia = "all")
Arguments
linha |
A character describing which element will be displayed in the rows of the data.frame. Defaults to "Município". |
coluna |
A character describing which element will be displayed in the columns of the data.frame. Defaults to "Não ativa". |
conteudo |
A character of length = 1 with the state's acronym of interest. |
periodo |
A character vector describing the period of data. Defaults to the last available. |
municipio |
"all" or a numeric vector with the IBGE's city codes codes to filter the data. Defaults to "all". |
capital |
"all" or a numeric vector with the IBGE's cities codes to filter the data. Defaults to "all". |
cir |
"all" or a numeric vector with the CIR's codes to filter the data. Defaults to "all". |
macrorregiao_de_saude |
"all" or a numeric vector with the Health macro-region's codes to filter the data. Defaults to "all". |
microrregiao_ibge |
"all" or a numeric vector with the IBGE's micro-region codes to filter the data. Defaults to "all". |
ride |
"all" or a numeric vector with the IBGE's metropolitan-region codes to filter the data. Defaults to "all". |
territorio_da_cidadania |
"all" or a numeric vector with the territory of citizenship codes to filter the data. Defaults to "all". |
mesorregiao_pndr |
"all" or a numeric vector with the PNDR's mesoregion codes to filter the data. Defaults to "all". |
amazonia_legal |
"all" or a character ("Sim" or "Não") indicating if only the Legal Amazon region must be included. Defaults to "all". |
semiarido |
"all" or a character ("Sim" or "Não") indicating if only the semiarid region must be included. Defaults to "all". |
faixa_de_fronteira |
"all" or a character ("Sim" or "Não") indicating if only the border area must be included. Defaults to "all". |
zona_de_fronteira |
"all" or a character ("Sim" or "Não") indicating if only the border strip must be included. Defaults to "all". |
municipio_de_extrema_pobreza |
"all" or a character ("Sim" or "Não") indicating if only the municipalities of extreme poverty must be included. Defaults to "all". |
causas_evitaveis |
"all" or a character vector with the evitable cause code (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
capitulo_cid10 |
"all" or a numeric vector with the ICD-10 chapter to filter the data. Defaults to "all". |
categoria_cid10 |
"all" or a character vector with the ICD-10 category codes (capital letter and two numbers) to filter the data. Defaults to "all". |
faixa_etaria |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_detalhada |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
sexo |
"all" or a character vector with the gender (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
cor_raca |
"all" or a character vector with the color/race (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
escolaridade |
"all" or a character vector with the instruction (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
estado_civil |
"all" or a character vector with the marital status (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
local_ocorrencia |
"all" or a character vector with the place of ocurrence to filter the data. Defaults to "all". |
Value
The function returns a data frame printed by parameters input.
Lifecycle
This function is deprecated. Use 'sim()' or 'sinasc()' with a named 'filtros' list. The legacy signature is retained for compatibility.
Author(s)
Renato Prado Siqueira rpradosiqueira@gmail.com
See Also
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
## Requesting data from the city of Campo Grande/MS
sim_evitb10_mun(municipio = 500270)
})
options(old_options)
Scrapes SIM's ICD-10 evitable causes data from ufs
Description
This function allows the user to retrive data from SIM's ICD-10 database much in the same way that is done by the online portal. The argument options refer to evitable causes in 5-74 age group data from the states unities.
Usage
sim_evitb10_uf(uf, linha = "Município", coluna = "Não ativa",
conteudo = 1, periodo = "last", municipio = "all", cir = "all",
macrorregiao_de_saude = "all", divisao_admnist_estadual = "all",
microrregiao_ibge = "all", ride = "all", causas_evitaveis = "all",
capitulo_cid10 = "all", categoria_cid10 = "all", faixa_etaria = "all",
faixa_etaria_detalhada = "all", sexo = "all", cor_raca = "all",
escolaridade = "all", estado_civil = "all", local_ocorrencia = "all")
Arguments
uf |
A character of length = 1 with the state's acronym of interest. |
linha |
A character describing which element will be displayed in the rows of the data.frame. Defaults to "Município". |
coluna |
A character describing which element will be displayed in the columns of the data.frame. Defaults to "Não ativa". |
conteudo |
A character of length = 1 with the state's acronym of interest. |
periodo |
A character vector describing the period of data. Defaults to the last available. |
municipio |
"all" or a numeric vector with the IBGE's city codes codes to filter the data. Defaults to "all". |
cir |
"all" or a numeric vector with the CIR's codes to filter the data. Defaults to "all". |
macrorregiao_de_saude |
"all" or a numeric vector with the Health macro-region's codes to filter the data. Defaults to "all". |
divisao_admnist_estadual |
"all" or a numeric vector with the State administrative division's codes to filter the data. Defaults to "all". |
microrregiao_ibge |
"all" or a numeric vector with the IBGE's micro-region codes to filter the data. Defaults to "all". |
ride |
"all" or a numeric vector with the IBGE's metropolitan-region codes to filter the data. Defaults to "all". |
causas_evitaveis |
"all" or a character vector with the evitable cause code (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
capitulo_cid10 |
"all" or a numeric vector with the ICD-10 chapter to filter the data. Defaults to "all". |
categoria_cid10 |
"all" or a character vector with the ICD-10 category codes (capital letter and two numbers) to filter the data. Defaults to "all". |
faixa_etaria |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_detalhada |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
sexo |
"all" or a character vector with the gender (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
cor_raca |
"all" or a character vector with the color/race (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
escolaridade |
"all" or a character vector with the instruction (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
estado_civil |
"all" or a character vector with the marital status (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
local_ocorrencia |
"all" or a character vector with the place of ocurrence to filter the data. Defaults to "all". |
Value
The function returns a data frame printed by parameters input.
Lifecycle
This function is deprecated. Use 'sim()' or 'sinasc()' with a named 'filtros' list. The legacy signature is retained for compatibility.
Author(s)
Renato Prado Siqueira rpradosiqueira@gmail.com
See Also
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
## Requesting data from the state of Mato Grosso do Sul
sim_evitb10_uf(uf = "ms")
})
options(old_options)
Scrapes SIM's ICD-10 child mortality data from regions
Description
This function allows the user to retrive data from SIM's ICD-10 database much in the same way that is done by the online portal. The argument options refer to child mortality data focused on focused on the regions and states.
Usage
sim_inf10_bruf(linha = "Região", coluna = "Não ativa",
conteudo = 1, periodo = "last", regiao = "all",
unidade_da_federacao = "all", capitulo_cid10 = "all",
categoria_cid10 = "all", lista_mort_cid10 = "all",
causa_mal_definidas = "all", causas_evitaveis_0a4anos = "all",
faixa_etaria_1 = "all", faixa_etaria_2 = "all", faixa_etaria_3 = "all",
faixa_etaria_4 = "all", faixa_etaria_5 = "all",
faixa_etaria_detalhada = "all", sexo = "all", cor_raca = "all",
local_ocorrencia = "all", idade_mae = "all", escolaridade_mae = "all",
duracao_gestacao = "all", tipo_gravidez = "all", tipo_parto = "all",
peso_ao_nascer = "all", obito_relacao_parto = "all",
obito_investigado = "all")
Arguments
linha |
A character describing which element will be displayed in the rows of the data.frame. Defaults to "Município". |
coluna |
A character describing which element will be displayed in the columns of the data.frame. Defaults to "Não ativa". |
conteudo |
A character of length = 1 with the state's acronym of interest. |
periodo |
A character vector describing the period of data. Defaults to the last available. |
regiao |
"all" or a numeric vector with the IBGE's region codes to filter the data. Defaults to "all". |
unidade_da_federacao |
"all" or a numeric vector with the IBGE's state codes to filter the data. Defaults to "all". |
capitulo_cid10 |
"all" or a numeric vector with the ICD-10 chapter to filter the data. Defaults to "all". |
categoria_cid10 |
"all" or a character vector with the ICD-10 category codes (capital letter and two numbers) to filter the data. Defaults to "all". |
lista_mort_cid10 |
"all" or a character vector with the mortality type (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
causa_mal_definidas |
"all" or a character vector with the ill-defined causes (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
causas_evitaveis_0a4anos |
"all" or a character vector with the evitable cause code (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_1 |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_2 |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_3 |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_4 |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_5 |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_detalhada |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
sexo |
"all" or a character vector with the gender (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
cor_raca |
"all" or a character vector with the color/race (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
local_ocorrencia |
"all" or a character vector with the place of ocurrence to filter the data. Defaults to "all". |
idade_mae |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
escolaridade_mae |
"all" or a character vector with the mother's instruction (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
duracao_gestacao |
"all" or a character vector with the marital status of the mother (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
tipo_gravidez |
"all" or a character vector with the type of pregnancy (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
tipo_parto |
"all" or a character vector with the Parturition type (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
peso_ao_nascer |
"all" or a character vector with the birth weight (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
obito_relacao_parto |
"all" or a character vector with period of child mortality in relation to childbirth (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
obito_investigado |
"all" or a character vector indicating if the death was investigated (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
Value
The function returns a data frame printed by parameters input.
Lifecycle
This function is deprecated. Use 'sim()' or 'sinasc()' with a named 'filtros' list. The legacy signature is retained for compatibility.
Author(s)
Renato Prado Siqueira rpradosiqueira@gmail.com
See Also
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
## Requesting data from Midwest region
sim_inf10_bruf(regiao = 5)
})
options(old_options)
Scrapes SIM's ICD-10 child mortality data from cities
Description
This function allows the user to retrive data from SIM's ICD-10 database much in the same way that is done by the online portal. The argument options refer to child mortality data focused on brazilian cities.
Usage
sim_inf10_mun(linha = "Município", coluna = "Não ativa",
conteudo = 1, periodo = "last", municipio = "all", capital = "all",
cir = "all", macrorregiao_de_saude = "all", microrregiao_ibge = "all",
ride = "all", territorio_da_cidadania = "all", mesorregiao_pndr = "all",
amazonia_legal = "all", semiarido = "all", faixa_de_fronteira = "all",
zona_de_fronteira = "all", municipio_de_extrema_pobreza = "all",
capitulo_cid10 = "all", categoria_cid10 = "all", lista_mort_cid10 = "all",
causa_mal_definidas = "all", causas_evitaveis_0a4anos = "all",
faixa_etaria_1 = "all", faixa_etaria_2 = "all", faixa_etaria_3 = "all",
faixa_etaria_4 = "all", faixa_etaria_5 = "all", faixa_etaria_detalhada = "all",
sexo = "all", cor_raca = "all", local_ocorrencia = "all", idade_mae = "all",
escolaridade_mae = "all", duracao_gestacao = "all", tipo_gravidez = "all",
tipo_parto = "all", peso_ao_nascer = "all", obito_relacao_parto = "all",
obito_investigado = "all")
Arguments
linha |
A character describing which element will be displayed in the rows of the data.frame. Defaults to "Município". |
coluna |
A character describing which element will be displayed in the columns of the data.frame. Defaults to "Não ativa". |
conteudo |
A character of length = 1 with the state's acronym of interest. |
periodo |
A character vector describing the period of data. Defaults to the last available. |
municipio |
"all" or a numeric vector with the IBGE's city codes codes to filter the data. Defaults to "all". |
capital |
"all" or a numeric vector with the IBGE's cities codes to filter the data. Defaults to "all". |
cir |
"all" or a numeric vector with the CIR's codes to filter the data. Defaults to "all". |
macrorregiao_de_saude |
"all" or a numeric vector with the Health macro-region's codes to filter the data. Defaults to "all". |
microrregiao_ibge |
"all" or a numeric vector with the IBGE's micro-region codes to filter the data. Defaults to "all". |
ride |
"all" or a numeric vector with the IBGE's metropolitan-region codes to filter the data. Defaults to "all". |
territorio_da_cidadania |
"all" or a numeric vector with the territory of citizenship codes to filter the data. Defaults to "all". |
mesorregiao_pndr |
"all" or a numeric vector with the PNDR's mesoregion codes to filter the data. Defaults to "all". |
amazonia_legal |
"all" or a character ("Sim" or "Não") indicating if only the Legal Amazon region must be included. Defaults to "all". |
semiarido |
"all" or a character ("Sim" or "Não") indicating if only the semiarid region must be included. Defaults to "all". |
faixa_de_fronteira |
"all" or a character ("Sim" or "Não") indicating if only the border area must be included. Defaults to "all". |
zona_de_fronteira |
"all" or a character ("Sim" or "Não") indicating if only the border strip must be included. Defaults to "all". |
municipio_de_extrema_pobreza |
"all" or a character ("Sim" or "Não") indicating if only the municipalities of extreme poverty must be included. Defaults to "all". |
capitulo_cid10 |
"all" or a numeric vector with the ICD-10 chapter to filter the data. Defaults to "all". |
categoria_cid10 |
"all" or a character vector with the ICD-10 category codes (capital letter and two numbers) to filter the data. Defaults to "all". |
lista_mort_cid10 |
"all" or a character vector with the mortality type (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
causa_mal_definidas |
"all" or a character vector with the ill-defined causes (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
causas_evitaveis_0a4anos |
"all" or a character vector with the evitable cause code (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_1 |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_2 |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_3 |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_4 |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_5 |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_detalhada |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
sexo |
"all" or a character vector with the gender (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
cor_raca |
"all" or a character vector with the color/race (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
local_ocorrencia |
"all" or a character vector with the place of ocurrence to filter the data. Defaults to "all". |
idade_mae |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
escolaridade_mae |
"all" or a character vector with the mother's instruction (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
duracao_gestacao |
"all" or a character vector with the marital status of the mother (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
tipo_gravidez |
"all" or a character vector with the type of pregnancy (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
tipo_parto |
"all" or a character vector with the Parturition type (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
peso_ao_nascer |
"all" or a character vector with the birth weight (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
obito_relacao_parto |
"all" or a character vector with period of child mortality in relation to childbirth (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
obito_investigado |
"all" or a character vector indicating if the death was investigated (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
Value
The function returns a data frame printed by parameters input.
Lifecycle
This function is deprecated. Use 'sim()' or 'sinasc()' with a named 'filtros' list. The legacy signature is retained for compatibility.
Author(s)
Renato Prado Siqueira rpradosiqueira@gmail.com
See Also
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
## Requesting data from the city of Campo Grande/MS
sim_inf10_mun(municipio = 500270)
})
options(old_options)
Scrapes SIM's ICD-10 child mortality data from ufs
Description
This function allows the user to retrive data from SIM's ICD-10 database much in the same way that is done by the online portal. The argument options refer to child mortality data from the states unities.
Usage
sim_inf10_uf(uf, linha = "Município", coluna = "Não ativa",
conteudo = 1, periodo = "last", municipio = "all", cir = "all",
macrorregiao_de_saude = "all", divisao_admnist_estadual = "all",
microrregiao_ibge = "all", ride = "all", capitulo_cid10 = "all",
categoria_cid10 = "all", lista_mort_cid10 = "all",
causa_mal_definidas = "all", faixa_etaria_1 = "all",
faixa_etaria_2 = "all", faixa_etaria_3 = "all", faixa_etaria_4 = "all",
faixa_etaria_5 = "all", faixa_etaria_detalhada = "all",
sexo = "all", cor_raca = "all", local_ocorrencia = "all",
idade_mae = "all", escolaridade_mae = "all",
duracao_gestacao = "all", tipo_gravidez = "all", tipo_parto = "all",
peso_ao_nascer = "all", obito_relacao_parto = "all",
obito_investigado = "all")
Arguments
uf |
A character of length = 1 with the state"all". |
linha |
A character describing which element will be displayed in the rows of the data.frame. Defaults to "Município". |
coluna |
A character describing which element will be displayed in the columns of the data.frame. Defaults to "Não ativa". |
conteudo |
A character of length = 1 with the state's acronym of interest. |
periodo |
A character vector describing the period of data. Defaults to the last available. |
municipio |
"all" or a numeric vector with the IBGE's city codes codes to filter the data. Defaults to "all". |
cir |
"all" or a numeric vector with the CIR's codes to filter the data. Defaults to "all". |
macrorregiao_de_saude |
"all" or a numeric vector with the Health macro-region's codes to filter the data. Defaults to "all". |
divisao_admnist_estadual |
"all" or a numeric vector with the State administrative division's codes to filter the data. Defaults to "all". |
microrregiao_ibge |
"all" or a numeric vector with the IBGE's micro-region codes to filter the data. Defaults to "all". |
ride |
"all" or a numeric vector with the IBGE's metropolitan-region codes to filter the data. Defaults to "all". |
capitulo_cid10 |
"all" or a numeric vector with the ICD-10 chapter to filter the data. Defaults to "all". |
categoria_cid10 |
"all" or a character vector with the ICD-10 category codes (capital letter and two numbers) to filter the data. Defaults to "all". |
lista_mort_cid10 |
"all" or a character vector with the mortality type (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
causa_mal_definidas |
"all" or a character vector with the ill-defined causes (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_1 |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_2 |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_3 |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_4 |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_5 |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_detalhada |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
sexo |
"all" or a character vector with the gender (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
cor_raca |
"all" or a character vector with the color/race (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
local_ocorrencia |
"all" or a character vector with the place of ocurrence to filter the data. Defaults to "all". |
idade_mae |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
escolaridade_mae |
"all" or a character vector with the mother's instruction (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
duracao_gestacao |
"all" or a character vector with the marital status of the mother (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
tipo_gravidez |
"all" or a character vector with the type of pregnancy (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
tipo_parto |
"all" or a character vector with the Parturition type (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
peso_ao_nascer |
"all" or a character vector with the birth weight (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
obito_relacao_parto |
"all" or a character vector with period of child mortality in relation to childbirth (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
obito_investigado |
"all" or a character vector indicating if the death was investigated (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
Value
The function returns a data frame printed by parameters input.
Lifecycle
This function is deprecated. Use 'sim()' or 'sinasc()' with a named 'filtros' list. The legacy signature is retained for compatibility.
Author(s)
Renato Prado Siqueira rpradosiqueira@gmail.com
See Also
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
## Requesting data from the state of Mato Grosso do Sul
sim_inf10_uf(uf = "ms")
})
options(old_options)
Read SIM death microdata
Description
Read SIM death microdata
Usage
sim_microdados(ano, uf = NULL, tipo = "DO", ...)
Arguments
ano |
One or more years. |
uf |
One or more state abbreviations. |
tipo |
SIM file type, default '"DO"'. |
... |
Additional arguments passed to [microdados_ler()]. |
Value
Record-level SIM data.
Scrapes SIM's ICD-10 data from regions
Description
This function allows the user to retrieve data from SIM's ICD-10 database much in the same way that is done by the online portal. The argument options refer to data focused on the regions and states.
Usage
sim_obt10_bruf(linha = "Região", coluna = "Não ativa",
conteudo = 1, periodo = "last", regiao = "all", unidade_da_federacao = "all",
capitulo_cid10 = "all", grupo_cid10 = "all", categoria_cid10 = "all",
causa_br_cid10 = "all", causa_mal_definida = "all", faixa_etaria = "all",
faixa_etaria_ops = "all", faixa_etaria_det = "all", faixa_etaria_menor1a = "all",
sexo = "all", cor_raca = "all", escolaridade = "all", estado_civil = "all",
local_ocorrencia = "all")
Arguments
linha |
A character describing which element will be displayed in the rows of the data.frame. Defaults to "Região". |
coluna |
A character describing which element will be displayed in the columns of the data.frame. Defaults to "Não ativa". |
conteudo |
A character of length = 1 with the state's acronym of interest. |
periodo |
A character vector describing the period of data. Defaults to the last available. |
regiao |
"all" or a numeric vector with the IBGE's region codes to filter the data. Defaults to "all". |
unidade_da_federacao |
"all" or a numeric vector with the IBGE's state codes to filter the data. Defaults to "all". |
capitulo_cid10 |
"all" or a numeric vector with the ICD-10 chapter to filter the data. Defaults to "all". |
grupo_cid10 |
"all" or a character vector with the ICD-10 group (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
categoria_cid10 |
"all" or a character vector with the ICD-10 category codes (capital letter and two numbers) to filter the data. Defaults to "all". |
causa_br_cid10 |
"all" or a character vector with the ICD-10 cause codes to filter the data. Defaults to "all". |
causa_mal_definida |
"all" or a character vector with the ill-defined causes (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_ops |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". "ops" in the argument name stands for Pan American Health Organization. |
faixa_etaria_det |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_menor1a |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
sexo |
"all" or a character vector with the gender (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
cor_raca |
"all" or a character vector with the color/race (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
escolaridade |
"all" or a character vector with the instruction (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
estado_civil |
"all" or a character vector with the marital status (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
local_ocorrencia |
"all" or a character vector with the place of ocurrence to filter the data. Defaults to "all". |
Value
The function returns a data frame printed by parameters input.
Lifecycle
This function is deprecated. Use 'sim()' or 'sinasc()' with a named 'filtros' list. The legacy signature is retained for compatibility.
Author(s)
Renato Prado Siqueira rpradosiqueira@gmail.com
See Also
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
## Requesting data from Midwest region
sim_obt10_bruf(region = 5)
})
options(old_options)
Scrapes SIM's ICD-10 data from cities
Description
This function allows the user to retrieve data from SIM's ICD-10 database much in the same way that is done by the online portal. The argument options refer to data focused on brazilian cities.
Usage
sim_obt10_mun(linha = "Município", coluna = "Não ativa",
conteudo = 1, periodo = "last", municipio = "all", capital = "all",
cir = "all", macrorregiao_de_saude = "all", microrregiao_ibge = "all",
ride = "all", territorio_da_cidadania = "all", mesorregiao_pndr = "all",
amazonia_legal = "all", semiarido = "all", faixa_de_fronteira = "all",
zona_de_fronteira = "all", municipio_de_extrema_pobreza = "all",
capitulo_cid10 = "all", grupo_cid10 = "all", categoria_cid10 = "all",
causa_br_cid10 = "all", causa_mal_definida = "all", faixa_etaria = "all",
faixa_etaria_ops = "all", faixa_etaria_det = "all", faixa_etaria_menor1a = "all",
sexo = "all", cor_raca = "all", escolaridade = "all", estado_civil = "all",
local_ocorrencia = "all")
Arguments
linha |
A character describing which element will be displayed in the rows of the data.frame. Defaults to "Município". |
coluna |
A character describing which element will be displayed in the columns of the data.frame. Defaults to "Não ativa". |
conteudo |
A character of length = 1 with the state's acronym of interest. |
periodo |
A character vector describing the period of data. Defaults to the last available. |
municipio |
"all" or a numeric vector with the IBGE's city codes codes to filter the data. Defaults to "all". |
capital |
"all" or a numeric vector with the IBGE's cities codes to filter the data. Defaults to "all". |
cir |
"all" or a numeric vector with the CIR's codes to filter the data. Defaults to "all". |
macrorregiao_de_saude |
"all" or a numeric vector with the Health macro-region's codes to filter the data. Defaults to "all". |
microrregiao_ibge |
"all" or a numeric vector with the IBGE's micro-region codes to filter the data. Defaults to "all". |
ride |
"all" or a numeric vector with the IBGE's metropolitan-region codes to filter the data. Defaults to "all". |
territorio_da_cidadania |
"all" or a numeric vector with the territory of citizenship codes to filter the data. Defaults to "all". |
mesorregiao_pndr |
"all" or a numeric vector with the PNDR's mesoregion codes to filter the data. Defaults to "all". |
amazonia_legal |
"all" or a character ("Sim" or "Não") indicating if only the Legal Amazon region must be included. Defaults to "all". |
semiarido |
"all" or a character ("Sim" or "Não") indicating if only the semiarid region must be included. Defaults to "all". |
faixa_de_fronteira |
"all" or a character ("Sim" or "Não") indicating if only the border area must be included. Defaults to "all". |
zona_de_fronteira |
"all" or a character ("Sim" or "Não") indicating if only the border strip must be included. Defaults to "all". |
municipio_de_extrema_pobreza |
"all" or a character ("Sim" or "Não") indicating if only the municipalities of extreme poverty must be included. Defaults to "all". |
capitulo_cid10 |
"all" or a numeric vector with the ICD-10 chapter to filter the data. Defaults to "all". |
grupo_cid10 |
"all" or a character vector with the ICD-10 group (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
categoria_cid10 |
"all" or a character vector with the ICD-10 category codes (capital letter and two numbers) to filter the data. Defaults to "all". |
causa_br_cid10 |
"all" or a character vector with the ICD-10 cause codes to filter the data. Defaults to "all". |
causa_mal_definida |
"all" or a character vector with the ill-defined causes (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_ops |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". "ops" in the argument name stands for Pan American Health Organization. |
faixa_etaria_det |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_menor1a |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
sexo |
"all" or a character vector with the gender (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
cor_raca |
"all" or a character vector with the color/race (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
escolaridade |
"all" or a character vector with the instruction (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
estado_civil |
"all" or a character vector with the marital status (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
local_ocorrencia |
"all" or a character vector with the place of ocurrence to filter the data. Defaults to "all". |
Value
The function returns a data frame printed by parameters input.
Lifecycle
This function is deprecated. Use 'sim()' or 'sinasc()' with a named 'filtros' list. The legacy signature is retained for compatibility.
Author(s)
Renato Prado Siqueira rpradosiqueira@gmail.com
See Also
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
## Requesting data from the city of Campo Grande/MS
sim_obt10_mun(municipio = 500270)
})
options(old_options)
Scrapes SIM's ICD-10 data from UF's
Description
This function allows the user to retrive data from SIM's ICD-10 database much in the same way that is done by the online portal. The argument options refer to data from the states unities.
Usage
sim_obt10_uf(uf, linha = "Município", coluna = "Não ativa",
conteudo = 1, periodo = "last", municipio = "all", cir = "all",
macrorregiao_de_saude = "all", divisao_admnist_estadual = "all",
microrregiao_ibge = "all", ride = "all", capitulo_cid10 = "all",
grupo_cid10 = "all", categoria_cid10 = "all", causa_br_cid10 = "all",
causa_mal_definida = "all", faixa_etaria = "all", faixa_etaria_ops = "all",
faixa_etaria_det = "all", faixa_etaria_menor1a = "all", sexo = "all",
cor_raca = "all", escolaridade = "all", estado_civil = "all",
local_ocorrencia = "all")
Arguments
uf |
A character of length = 1 with the state's acronym of interest. |
linha |
A character describing which element will be displayed in the rows of the data.frame. Defaults to "Município". |
coluna |
A character describing which element will be displayed in the columns of the data.frame. Defaults to "Não ativa". |
conteudo |
A character of length = 1 with the state's acronym of interest. |
periodo |
A character vector describing the period of data. Defaults to the last available. |
municipio |
"all" or a numeric vector with the IBGE's city codes codes to filter the data. Defaults to "all". |
cir |
"all" or a numeric vector with the CIR's codes to filter the data. Defaults to "all". |
macrorregiao_de_saude |
"all" or a numeric vector with the Health macro-region's codes to filter the data. Defaults to "all". |
divisao_admnist_estadual |
"all" or a numeric vector with the State administrative division's codes to filter the data. Defaults to "all". |
microrregiao_ibge |
"all" or a numeric vector with the IBGE's micro-region codes to filter the data. Defaults to "all". |
ride |
"all" or a numeric vector with the IBGE's metropolitan-region codes to filter the data. Defaults to "all". |
capitulo_cid10 |
"all" or a numeric vector with the ICD-10 chapter to filter the data. Defaults to "all". |
grupo_cid10 |
"all" or a character vector with the ICD-10 group (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
categoria_cid10 |
"all" or a character vector with the ICD-10 category codes (capital letter and two numbers) to filter the data. Defaults to "all". |
causa_br_cid10 |
"all" or a character vector with the ICD-10 cause codes to filter the data. Defaults to "all". |
causa_mal_definida |
"all" or a character vector with the ill-defined causes (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_ops |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". "ops" in the argument name stands for Pan American Health Organization. |
faixa_etaria_det |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
faixa_etaria_menor1a |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
sexo |
"all" or a character vector with the gender (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
cor_raca |
"all" or a character vector with the color/race (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
escolaridade |
"all" or a character vector with the instruction (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
estado_civil |
"all" or a character vector with the marital status (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
local_ocorrencia |
"all" or a character vector with the place of ocurrence to filter the data. Defaults to "all". |
Value
The function returns a data frame printed by parameters input.
Lifecycle
This function is deprecated. Use 'sim()' or 'sinasc()' with a named 'filtros' list. The legacy signature is retained for compatibility.
Author(s)
Renato Prado Siqueira rpradosiqueira@gmail.com
See Also
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
## Requesting data from the state of Mato Grosso do Sul
sim_obt10_uf(uf = "ms")
})
options(old_options)
Query notifiable diseases and conditions from SINAN
Description
Supports the disease-specific TABNET datasets listed by 'datasus_catalogo("sinan")'. Because each disease has its own form, inspect dimensions, periods and filters with 'datasus_opcoes("sinan", agravo)'. Febre amarela is not included because its official link points to a separate open-data platform rather than a TABNET form.
Usage
sinan(
agravo = "dengue",
uf = NULL,
linha = NULL,
coluna = NULL,
conteudo = 1,
periodo = "last",
filtros = list()
)
Arguments
agravo |
Notifiable disease or condition listed by 'datasus_catalogo("sinan")'. |
uf |
Two-letter state abbreviation. 'NULL' uses the Brazil form. |
linha |
Row dimension. ‘NULL' selects the form’s first dimension. |
coluna |
Column dimension. 'NULL' selects '"Não ativa"'. |
conteudo |
Measure label, raw TABNET value, or one-based index. |
periodo |
'"last"' for the latest available period, an exact period label or raw value, a four-digit year, or a vector of these values. |
filtros |
Named list of filters. Names and choices are available from [datasus_opcoes()]. |
Value
A data frame containing the TABNET result.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
sinan("dengue", uf = "MS")
sinan(
"violencia_interpessoal_autoprovocada",
uf = "MS",
periodo = 2024
)
})
options(old_options)
Read current SINAN dengue microdata
Description
Downloads the annual OpenDataSUS resources. This complements the aggregated legacy TABNET interface available from 'sinan("dengue")'.
Usage
sinan_dengue(
ano = "last",
formato = "CSV",
destino = NULL,
cache = TRUE,
atualizar = FALSE,
n_max = Inf,
...
)
Arguments
ano |
Dataset year or '"last"'. |
formato |
'"CSV"' or '"JSON"'. |
destino |
Optional destination file or existing directory. |
cache |
Whether to reuse the local cache. |
atualizar |
Whether to force a new metadata query and download. |
n_max |
Maximum number of CSV rows to read. |
... |
Additional arguments passed to the underlying reader. |
Value
The parsed OpenDataSUS resource.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
dengue <- sinan_dengue(ano = 2025, n_max = 1000)
})
options(old_options)
Read current e-SUS SINAN Mpox microdata
Description
Read current e-SUS SINAN Mpox microdata
Usage
sinan_mpox(
ano = "last",
formato = "CSV",
destino = NULL,
cache = TRUE,
atualizar = FALSE,
n_max = Inf,
...
)
Arguments
ano |
Dataset year or '"last"'. |
formato |
'"CSV"' or '"JSON"'. |
destino |
Optional destination file or existing directory. |
cache |
Whether to reuse the local cache. |
atualizar |
Whether to force a new metadata query and download. |
n_max |
Maximum number of CSV rows to read. |
... |
Additional arguments passed to the underlying reader. |
Value
The parsed OpenDataSUS resource.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
cases <- sinan_mpox(ano = 2025, n_max = 1000)
})
options(old_options)
Query live-birth data from SINASC
Description
Provides a single interface to the Live Birth Information System (SINASC). Current row, column, measure, period and filter choices can be inspected with 'datasus_opcoes("sinasc", ...)'.
Usage
sinasc(
conjunto = "nascidos_vivos",
abrangencia = c("municipio", "uf"),
uf = NULL,
linha = NULL,
coluna = NULL,
conteudo = 1,
periodo = "last",
filtros = list()
)
Arguments
conjunto |
SINASC dataset. Currently '"nascidos_vivos"'. |
abrangencia |
Geographic form: '"municipio"' for municipality-level results or '"uf"' for region/state-level results. |
uf |
Optional state abbreviation, two-digit IBGE code or state name. With 'abrangencia = "municipio"', selects the state-specific municipal form. It must be 'NULL' with 'abrangencia = "uf"'. |
linha |
Row dimension. ‘NULL' selects the form’s first dimension. |
coluna |
Column dimension. 'NULL' selects '"Não ativa"'. |
conteudo |
Measure label, raw TABNET value or one-based index. |
periodo |
'"last"' for the latest available year, an exact period label or raw value, a four-digit year, or a vector of these values. |
filtros |
Named list of filters. Use [datasus_opcoes()] to inspect their names and accepted values. |
Value
A data frame containing the TABNET result, with query provenance available through [datasus_proveniencia()].
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
op <- datasus_opcoes(
"sinasc", abrangencia = "municipio", uf = "SP"
)
nascimentos <- sinasc(
uf = "SP",
periodo = 2024,
filtros = list(sexo = "Masculino")
)
})
options(old_options)
Read SINASC live birth microdata
Description
Read SINASC live birth microdata
Usage
sinasc_microdados(ano, uf = NULL, tipo = "DN", ...)
Arguments
ano |
One or more years. |
uf |
One or more state abbreviations. |
tipo |
SIM file type, default '"DO"'. |
... |
Additional arguments passed to [microdados_ler()]. |
Value
Record-level SINASC data.
Scrapes SINASC data from regions
Description
This function allows the user to retrive data from SINASC database much in the same way that is done by the online portal. The argument options refer to data focused on the regions and states.
Usage
sinasc_nv_bruf(linha = "Região", coluna = "Não ativa",
conteudo = 1, periodo = "last", regiao = "all", unidade_da_federacao = "all",
local_ocorrencia = "all", idade_da_mae = "all", instrucao_da_mae = "all",
estado_civil_mae = "all", duracao_gestacao = "all", tipo_de_gravidez = "all",
tipo_de_parto = "all", consult_pre_natal = "all", sexo = "all",
cor_raca = "all", apgar_1_minuto = "all", apgar_5_minuto = "all",
peso_ao_nascer = "all", anomalia_congenita = "all", tipo_anomal_congen = "all")
Arguments
linha |
A character describing which element will be displayed in the rows of the data.frame. Defaults to "Município". |
coluna |
A character describing which element will be displayed in the columns of the data.frame. Defaults to "Não ativa". |
conteudo |
A character of length = 1 with the state's acronym of interest. |
periodo |
A character vector describing the period of data. Defaults to the last available. |
regiao |
"all" or a numeric vector with the IBGE's region codes to filter the data. Defaults to "all". |
unidade_da_federacao |
"all" or a numeric vector with the IBGE's state codes to filter the data. Defaults to "all". |
local_ocorrencia |
"all" or a character vector with the place of ocurrence to filter the data. Defaults to "all". |
idade_da_mae |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
instrucao_da_mae |
"all" or a character vector with the mother's instruction (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
estado_civil_mae |
"all" or a character vector with the marital status of the mother (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
duracao_gestacao |
"all" or a character vector with the marital status of the mother (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
tipo_de_gravidez |
"all" or a character vector with the type of pregnancy (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
tipo_de_parto |
"all" or a character vector with the Parturition type (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
consult_pre_natal |
"all" or a character vector with the amount of prenatal consultation (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
sexo |
"all" or a character vector with the gender (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
cor_raca |
"all" or a character vector with the color/race (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
apgar_1_minuto |
"all" or a character vector with the value of the apgar exam of the first minute (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
apgar_5_minuto |
"all" or a character vector with the value of the apgar exam of the fifth minute (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
peso_ao_nascer |
"all" or a character vector with the birth weight (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
anomalia_congenita |
"all" or a character vector with the indicative of congenital anomaly (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
tipo_anomal_congen |
"all" or a character vector with the congenital anomaly type (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
Value
The function returns a data frame printed by parameters input.
Lifecycle
This function is deprecated. Use 'sim()' or 'sinasc()' with a named 'filtros' list. The legacy signature is retained for compatibility.
Author(s)
Renato Prado Siqueira rpradosiqueira@gmail.com
See Also
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
## Requesting data from Midwest region
sinasc_nv_bruf(region = 5)
})
options(old_options)
Scrapes SINASC data from cities
Description
This function allows the user to retrive data from SINASC database much in the same way that is done by the online portal. The argument options refer to data focused on brazilian cities.
Usage
sinasc_nv_mun(linha = "Município", coluna = "Não ativa",
conteudo = 1, periodo = "last", municipio = "all", capital = "all",
cir = "all", macrorregiao_de_saude = "all", microrregiao_ibge = "all",
ride = "all", territorio_da_cidadania = "all", mesorregiao_pndr = "all",
amazonia_legal = "all", semiarido = "all", faixa_de_fronteira = "all",
zona_de_fronteira = "all", municipio_de_extrema_pobreza = "all",
local_ocorrencia = "all", idade_da_mae = "all", instrucao_da_mae = "all",
estado_civil_mae = "all", duracao_gestacao = "all", tipo_de_gravidez = "all",
tipo_de_parto = "all", consult_pre_natal = "all", sexo = "all", cor_raca = "all",
apgar_1_minuto = "all", apgar_5_minuto = "all", peso_ao_nascer = "all",
anomalia_congenita = "all", tipo_anomal_congen = "all")
Arguments
linha |
A character describing which element will be displayed in the rows of the data.frame. Defaults to "Município". |
coluna |
A character describing which element will be displayed in the columns of the data.frame. Defaults to "Não ativa". |
conteudo |
A character of length = 1 with the state's acronym of interest. |
periodo |
A character vector describing the period of data. Defaults to the last available. |
municipio |
"all" or a numeric vector with the IBGE's city codes codes to filter the data. Defaults to "all". |
capital |
"all" or a numeric vector with the IBGE's cities codes to filter the data. Defaults to "all". |
cir |
"all" or a numeric vector with the CIR's codes to filter the data. Defaults to "all". |
macrorregiao_de_saude |
"all" or a numeric vector with the Health macro-region's codes to filter the data. Defaults to "all". |
microrregiao_ibge |
"all" or a numeric vector with the IBGE's micro-region codes to filter the data. Defaults to "all". |
ride |
"all" or a numeric vector with the IBGE's metropolitan-region codes to filter the data. Defaults to "all". |
territorio_da_cidadania |
"all" or a numeric vector with the territory of citizenship codes to filter the data. Defaults to "all". |
mesorregiao_pndr |
"all" or a numeric vector with the PNDR's mesoregion codes to filter the data. Defaults to "all". |
amazonia_legal |
"all" or a character ("Sim" or "Não") indicating if only the Legal Amazon region must be included. Defaults to "all". |
semiarido |
"all" or a character ("Sim" or "Não") indicating if only the semiarid region must be included. Defaults to "all". |
faixa_de_fronteira |
"all" or a character ("Sim" or "Não") indicating if only the border area must be included. Defaults to "all". |
zona_de_fronteira |
"all" or a character ("Sim" or "Não") indicating if only the border strip must be included. Defaults to "all". |
municipio_de_extrema_pobreza |
"all" or a character ("Sim" or "Não") indicating if only the municipalities of extreme poverty must be included. Defaults to "all". |
local_ocorrencia |
"all" or a character vector with the place of ocurrence to filter the data. Defaults to "all". |
idade_da_mae |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
instrucao_da_mae |
"all" or a character vector with the mother's instruction (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
estado_civil_mae |
"all" or a character vector with the marital status of the mother (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
duracao_gestacao |
"all" or a character vector with the marital status of the mother (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
tipo_de_gravidez |
"all" or a character vector with the type of pregnancy (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
tipo_de_parto |
"all" or a character vector with the Parturition type (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
consult_pre_natal |
"all" or a character vector with the amount of prenatal consultation (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
sexo |
"all" or a character vector with the gender (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
cor_raca |
"all" or a character vector with the color/race (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
apgar_1_minuto |
"all" or a character vector with the value of the apgar exam of the first minute (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
apgar_5_minuto |
"all" or a character vector with the value of the apgar exam of the fifth minute (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
peso_ao_nascer |
"all" or a character vector with the birth weight (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
anomalia_congenita |
"all" or a character vector with the indicative of congenital anomaly (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
tipo_anomal_congen |
"all" or a character vector with the congenital anomaly type (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
Value
The function returns a data frame printed by parameters input.
Lifecycle
This function is deprecated. Use 'sim()' or 'sinasc()' with a named 'filtros' list. The legacy signature is retained for compatibility.
Author(s)
Renato Prado Siqueira rpradosiqueira@gmail.com
See Also
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
## Requesting data from the city of Campo Grande/MS
sinasc_nv_mun(municipio = 500270)
})
options(old_options)
Scrapes SINASC data from ufs
Description
This function allows the user to retrive data from SINASC database much in the same way that is done by the online portal. The argument options refer to data from the states unities.
Usage
sinasc_nv_uf(uf, linha = "Município", coluna = "Não ativa",
conteudo = 1, periodo = "last", municipio = "all", cir = "all",
macrorregiao_de_saude = "all", divisao_admnist_estadual = "all",
microrregiao_ibge = "all", ride = "all", local_ocorrencia = "all",
idade_da_mae = "all", instrucao_da_mae = "all", estado_civil_mae = "all",
duracao_gestacao = "all", tipo_de_gravidez = "all", tipo_de_parto = "all",
consult_pre_natal = "all", sexo = "all", cor_raca = "all", apgar_1_minuto = "all",
apgar_5_minuto = "all", peso_ao_nascer = "all", anomalia_congenita = "all",
tipo_anomal_congen = "all")
Arguments
uf |
A character of length = 1 with the state's acronym of interest. |
linha |
A character describing which element will be displayed in the rows of the data.frame. Defaults to "Município". |
coluna |
A character describing which element will be displayed in the columns of the data.frame. Defaults to "Não ativa". |
conteudo |
A character of length = 1 with the state's acronym of interest. |
periodo |
A character vector describing the period of data. Defaults to the last available. |
municipio |
"all" or a numeric vector with the IBGE's city codes codes to filter the data. Defaults to "all". |
cir |
"all" or a numeric vector with the CIR's codes to filter the data. Defaults to "all". |
macrorregiao_de_saude |
"all" or a numeric vector with the Health macro-region's codes to filter the data. Defaults to "all". |
divisao_admnist_estadual |
"all" or a numeric vector with the State administrative division's codes to filter the data. Defaults to "all". |
microrregiao_ibge |
"all" or a numeric vector with the IBGE's micro-region codes to filter the data. Defaults to "all". |
ride |
"all" or a numeric vector with the IBGE's metropolitan-region codes to filter the data. Defaults to "all". |
local_ocorrencia |
"all" or a character vector with the place of ocurrence to filter the data. Defaults to "all". |
idade_da_mae |
"all" or a character vector with the age range (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
instrucao_da_mae |
"all" or a character vector with the mother's instruction (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
estado_civil_mae |
"all" or a character vector with the marital status of the mother (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
duracao_gestacao |
"all" or a character vector with the marital status of the mother (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
tipo_de_gravidez |
"all" or a character vector with the type of pregnancy (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
tipo_de_parto |
"all" or a character vector with the Parturition type (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
consult_pre_natal |
"all" or a character vector with the amount of prenatal consultation (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
sexo |
"all" or a character vector with the gender (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
cor_raca |
"all" or a character vector with the color/race (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
apgar_1_minuto |
"all" or a character vector with the value of the apgar exam of the first minute (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
apgar_5_minuto |
"all" or a character vector with the value of the apgar exam of the fifth minute (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
peso_ao_nascer |
"all" or a character vector with the birth weight (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
anomalia_congenita |
"all" or a character vector with the indicative of congenital anomaly (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
tipo_anomal_congen |
"all" or a character vector with the congenital anomaly type (written in the same way) or the number corresponding to the order of the option in the online layout to filter the data. Defaults to "all". |
Value
The function returns a data frame printed by parameters input.
Lifecycle
This function is deprecated. Use 'sim()' or 'sinasc()' with a named 'filtros' list. The legacy signature is retained for compatibility.
Author(s)
Renato Prado Siqueira rpradosiqueira@gmail.com
See Also
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
## Requesting data from the state of Mato Grosso do Sul
sinasc_nv_uf(uf = "ms")
})
options(old_options)
Query cancer screening and diagnostic exams from SISCAN
Description
Supports cervical cytology and histology, mammography, and breast cytology and histology by residence, attendance location or patient.
Usage
siscan(
conjunto = "citologia_colo_residencia",
uf = NULL,
linha = NULL,
coluna = NULL,
conteudo = 1,
periodo = "last",
filtros = list()
)
Arguments
conjunto |
Dataset name listed by 'datasus_catalogo("sih")'. |
uf |
Two-letter state abbreviation. 'NULL' uses the Brazil form. |
linha |
Row dimension. ‘NULL' selects the form’s first dimension. |
coluna |
Column dimension. 'NULL' selects '"Não ativa"'. |
conteudo |
Measure label, raw TABNET value, or one-based index. |
periodo |
'"last"' for the latest competence, an exact period label or raw value, a four-digit year (all available competences in that year), or a vector of these values. |
filtros |
Named list of filters. Names and choices are available from [datasus_opcoes()]. |
Value
A data frame containing the TABNET result.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
siscan(uf = "MS")
siscan(
conjunto = "mamografia_residencia",
uf = "MS",
periodo = 2025
)
})
options(old_options)
Query legacy nutritional surveillance data from SISVAN
Description
Provides the historical TABNET series for Primary Care users and Bolsa Familia beneficiaries. These are legacy series and should not be interpreted as the current SISVAN coverage.
Usage
sisvan(
conjunto = "atencao_basica",
uf = NULL,
linha = NULL,
coluna = NULL,
conteudo = 1,
periodo = "last",
filtros = list()
)
Arguments
conjunto |
Dataset name listed by 'datasus_catalogo("sih")'. |
uf |
Two-letter state abbreviation. 'NULL' uses the Brazil form. |
linha |
Row dimension. ‘NULL' selects the form’s first dimension. |
coluna |
Column dimension. 'NULL' selects '"Não ativa"'. |
conteudo |
Measure label, raw TABNET value, or one-based index. |
periodo |
'"last"' for the latest competence, an exact period label or raw value, a four-digit year (all available competences in that year), or a vector of these values. |
filtros |
Named list of filters. Names and choices are available from [datasus_opcoes()]. |
Value
A data frame containing the TABNET result.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
sisvan(uf = "MS")
sisvan(conjunto = "bolsa_familia", uf = "MS")
})
options(old_options)
Read SIVEP-Gripe severe acute respiratory syndrome microdata
Description
Read SIVEP-Gripe severe acute respiratory syndrome microdata
Usage
sivep_gripe(
ano = "last",
formato = "CSV",
destino = NULL,
cache = TRUE,
atualizar = FALSE,
n_max = Inf,
...
)
Arguments
ano |
Dataset year or '"last"'. |
formato |
'"CSV"' or '"JSON"'. |
destino |
Optional destination file or existing directory. |
cache |
Whether to reuse the local cache. |
atualizar |
Whether to force a new metadata query and download. |
n_max |
Maximum number of CSV rows to read. |
... |
Additional arguments passed to the underlying reader. |
Value
The parsed OpenDataSUS resource.
Examples
old_options <- options(
datasus.timeout = 5,
datasus.download_timeout = 15,
datasus.max_tries = 1
)
try({
srag <- sivep_gripe(ano = 2025, n_max = 1000)
})
options(old_options)
Calculate grouped incidence rates
Description
Calculate grouped incidence rates
Usage
taxa_incidencia(
dados,
casos,
populacao,
grupo = NULL,
multiplicador = 1e+05,
confianca = NULL,
na_rm = FALSE,
zero_denominador = c("na", "erro")
)
Arguments
dados |
A non-empty data frame. |
casos |
Name of the incident cases column. |
populacao |
Name of the population or person-time denominator column. |
grupo |
Optional character vector naming grouping columns. |
multiplicador |
Positive rate scale, default 100,000. |
confianca |
Optional confidence level. Exact intervals are available for rates, proportions and case fatality, but not for ratios. |
na_rm |
Whether rows with a missing numerator or denominator should be removed pairwise within each group. A group containing no complete row remains missing. |
zero_denominador |
How to handle zero denominators: '"na"' returns 'NA', while '"erro"' stops. |
Value
A data frame with aggregated counts and 'taxa_incidencia'.
Examples
dados <- data.frame(ano = c(2024, 2024), casos = c(10, 20),
populacao = c(50000, 50000))
taxa_incidencia(dados, "casos", "populacao", grupo = "ano")
Calculate grouped mortality rates
Description
Calculate grouped mortality rates
Usage
taxa_mortalidade(
dados,
obitos,
populacao,
grupo = NULL,
multiplicador = 1e+05,
confianca = NULL,
na_rm = FALSE,
zero_denominador = c("na", "erro")
)
Arguments
dados |
A non-empty data frame. |
obitos |
Name of the deaths column. |
populacao |
Name of the population denominator column. |
grupo |
Optional character vector naming grouping columns. |
multiplicador |
Positive rate scale, default 100,000. |
confianca |
Optional confidence level. Exact intervals are available for rates, proportions and case fatality, but not for ratios. |
na_rm |
Whether rows with a missing numerator or denominator should be removed pairwise within each group. A group containing no complete row remains missing. |
zero_denominador |
How to handle zero denominators: '"na"' returns 'NA', while '"erro"' stops. |
Value
A data frame with aggregated counts and 'taxa_mortalidade'.
Examples
dados <- data.frame(ano = c(2024, 2024), obitos = c(3, 7),
populacao = c(5000, 5000))
taxa_mortalidade(dados, "obitos", "populacao", grupo = "ano")
Validate IBGE territorial codes
Description
Validate IBGE territorial codes
Usage
validar_codigo_ibge(codigo, nivel = c("municipio", "uf", "regiao"))
Arguments
codigo |
Vector of territorial identifiers. |
nivel |
Territorial level: '"municipio"', '"uf"' or '"regiao"'. |
Value
A logical vector. Missing and unknown values return 'FALSE'.
Examples
validar_codigo_ibge(c("500270", "999999"))
validar_codigo_ibge(c("MS", "XX"), "uf")