| tidy_rreo | R Documentation |
Filters a long RREO tibble (typically produced by get_rreo()) down to the
rows that match a known indicator for topic (and optionally regime),
using the rules in rreo_layout(). Account labels are matched on a
year-stable, accent-folded key (Roman numerals and formula text are
stripped before comparison), so the same call returns a coherent series
across years even when SICONFI relabelled the appendix or account.
tidy_rreo(data, topic, regime = NULL)
data |
A tibble returned by |
topic |
Character. Topic name (e.g., |
regime |
Optional character. Filter to a subset of regimes within
|
Currently supported topics:
"previdencia" — federal previdência (RGPS, RPPS civis, FCDF, militares
inativos) for the União sphere. Anexos 04.1 / 04.2 / 04.3 / 04.4 of the
RREO; the layout knows that the RGPS appendix moved from 04.3 (up to 2022) to
04.4 (2023+) and that civis/FCDF moved from 04.1 (up to 2022) to 04.2 (2023+).
Pull requests adding new topics to inst/extdata/rreo_layout.csv are
welcome.
A tibble with the matched rows, plus extra columns:
indicador: stable indicator name (e.g.,
"resultado_previdenciario_rgps").
regime: matched regime.
coluna_padrao, coluna_ano: see rreo_normalize_columns().
Other RREO tidy:
rreo_layout(),
rreo_normalize_columns()
## Not run:
library(dplyr)
rreo <- purrr::map_dfr(2019:2023, \(yr) {
get_rreo(an_exercicio = yr, nr_periodo = 6,
co_tipo_demonstrativo = "RREO",
no_anexo = rreo_layout()$no_anexo[
rreo_layout()$topic == "previdencia" &
rreo_layout()$regime == "rgps" &
yr >= rreo_layout()$first_year &
yr <= rreo_layout()$last_year
][1],
co_esfera = "U", id_ente = 1)
})
tidy_rreo(rreo, topic = "previdencia", regime = "rgps") |>
filter(coluna_padrao == "DESPESAS LIQUIDADAS ATÉ O BIMESTRE",
is.na(coluna_ano) | coluna_ano == exercicio) |>
select(exercicio, indicador, valor)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.