Learn R Programming

tesouror (version 0.2.2)

get_rreo_for_state: Get RREO data for all municipalities of a Brazilian state

Description

Fetches RREO data for every municipality of state_uf, looping over get_rreo() with fault tolerance: if an individual municipality call fails after all retries, the failure is recorded and the loop continues. Failed calls are returned in attr(result, "failed").

Usage

get_rreo_for_state(
  state_uf,
  an_exercicio,
  nr_periodo,
  co_tipo_demonstrativo,
  no_anexo,
  include_capital = TRUE,
  on_error = c("warn", "stop", "silent"),
  use_cache = TRUE,
  verbose = FALSE,
  page_size = NULL,
  max_rows = Inf
)

get_budget_report_for_state(state_uf, fiscal_year, period, report_type, appendix, include_capital = TRUE, on_error = c("warn", "stop", "silent"), use_cache = TRUE, verbose = FALSE, page_size = NULL, max_rows = Inf)

Value

A tibble with RREO rows for all successful municipalities. If any call failed, has an attribute "failed" (tibble with iteration, id, error).

Arguments

state_uf

Character. Two-letter UF code (e.g., "PE", "ES"). Required.

an_exercicio

Integer. Fiscal year. Required.

nr_periodo

Integer. Bimester (1-6). Required.

co_tipo_demonstrativo

Character. "RREO" or "RREO Simplificado". Required.

no_anexo

Character. Appendix name (e.g., "RREO-Anexo 01"). Required.

include_capital

Logical. Include the state capital? Defaults to TRUE.

on_error

Character. One of "warn" (default — log and continue), "stop" (abort on first failure), or "silent" (record but no message).

use_cache

Logical. If TRUE (default), uses the in-memory cache.

verbose

Logical. If TRUE, prints the full API URL for each call.

page_size

Integer or NULL. Rows per API page.

max_rows

Numeric. Maximum rows per municipality call.

fiscal_year

Integer. Fiscal year. Required. Maps to an_exercicio.

period

Integer. Bimester (1-6). Required. Maps to nr_periodo.

report_type

Character. "RREO" or "RREO Simplificado". Required. Maps to co_tipo_demonstrativo.

appendix

Character. Appendix name. Required. Maps to no_anexo.

Details

This is the recommended way to assemble a state-wide panel: it handles pagination per municipality, uses the cache, and surfaces partial failures instead of aborting on the first error (see SICONFI behaviour for entities that have not yet homologated a given report).

get_budget_report_for_state() is an English-parameter alias.

See Also

Other SICONFI: get_anexos(), get_dca(), get_dca_for_state(), get_entes(), get_extrato(), get_msc_controle(), get_msc_orcamentaria(), get_msc_patrimonial(), get_rgf(), get_rgf_for_state(), get_rreo()

Examples

Run this code
if (FALSE) {
rreo_es <- get_rreo_for_state(
  state_uf = "ES", an_exercicio = 2021, nr_periodo = 6,
  co_tipo_demonstrativo = "RREO", no_anexo = "RREO-Anexo 01"
)
attr(rreo_es, "failed")
}

Run the code above in your browser using DataLab