Learn R Programming

tesouror (version 0.2.2)

rreo_normalize_columns: Normalize the coluna field of a RREO tibble across years

Description

SICONFI's RREO column labels drift over years: the same conceptual column appears as "DESPESAS LIQUIDADAS ATÉ O BIMESTRE / 2019" in 2019, "DESPESAS LIQUIDADAS ATÉ O BIMESTRE" (no year) in 2021-2022, and "DESPESAS LIQUIDADAS ATÉ O BIMESTRE / 2023" in 2023+. This helper adds two columns:

Usage

rreo_normalize_columns(data)

Value

The input tibble with coluna_padrao and coluna_ano appended.

Arguments

data

A tibble returned by get_rreo() or get_rreo_for_state(). Must contain a coluna column.

Details

  • coluna_padrao: the column label with any trailing "/ YYYY" or "EM YYYY" suffix removed (whitespace squished).

  • coluna_ano: the year that appeared in the suffix (integer), or NA when no year was present. Useful for distinguishing the current-year column from a comparative previous-year column.

See Also

Other RREO tidy: rreo_layout(), tidy_rreo()

Examples

Run this code
demo <- tibble::tibble(
  coluna = c(
    "DESPESAS LIQUIDADAS ATÉ O BIMESTRE / 2023",
    "DESPESAS LIQUIDADAS ATÉ O BIMESTRE",
    "INSCRITAS EM RESTOS A PAGAR NÃO PROCESSADOS EM 2023"
  )
)
rreo_normalize_columns(demo)

Run the code above in your browser using DataLab