get_ipca_from_target: Get IPCA vs. Inflation Target Gap

View source: R/get_ipca_from_target.R

get_ipca_from_targetR Documentation

Get IPCA vs. Inflation Target Gap

Description

Compares 12-month accumulated IPCA inflation against the official inflation target set annually by the CMN (Conselho Monetário Nacional), and returns both series plus the gap between them (positive means inflation is running above target).

Usage

get_ipca_from_target(
  start_date = NULL,
  end_date = NULL,
  language = "eng",
  labels = TRUE
)

Arguments

start_date

Start date for the data period. Accepts multiple formats:

  • "YYYY" for year only (e.g., "2020" becomes "2020-01-01")

  • "YYYY-MM" for year and month (e.g., "2020-06" becomes "2020-06-01")

  • "YYYY-MM-DD" for a specific date (e.g., "2020-06-15")

  • NULL defaults to "2020-01-01"

end_date

End date for the data period. Accepts the same formats as start_date:

  • "YYYY" (e.g., "2023" becomes "2023-12-31")

  • "YYYY-MM" (e.g., "2023-12" becomes the last day of December 2023)

  • "YYYY-MM-DD" for a specific date

  • NULL defaults to the current date (today)

language

Language for the labelled variable descriptions attached to the returned data.frame ("eng" or "pt").

labels

Logical indicating whether to add variable labels using the labelled package.

Value

A data.frame with columns:

date

Reference date (monthly)

ipca_12m

IPCA inflation accumulated over the trailing 12 months (%)

target

Official CMN inflation target for that calendar year (%)

gap

ipca_12m - target, in percentage points

Note

Series used: SGS 13522 ("IPCA - Variação acumulada em 12 meses"), monthly, and SGS 13521 ("Meta para a inflação", set by the CMN), which has annual frequency — one value per calendar year. The target is broadcast to every month of its year via a left join on the year, so it lines up with the monthly ipca_12m series. If the CMN has not yet set a target for the most recent year in the requested window, target/gap will be NA for those months rather than silently reusing an old value.

Examples


  df <- get_ipca_from_target()
  df2 <- get_ipca_from_target("2015", "2024", language = "pt")
  


brfinance documentation built on Nov. 14, 2026, 5:09 p.m.