View source: R/fetch-sidra-series.R
| fetch_sidra_rolling_quarters | R Documentation |
Downloads PNADC labor market indicators from IBGE's SIDRA API. These series are published as rolling quarterly averages (trimestre movel), with 12 observations per year.
fetch_sidra_rolling_quarters(
series = "all",
theme = NULL,
theme_category = NULL,
subcategory = NULL,
exclude_derived = FALSE,
use_cache = FALSE,
verbose = TRUE,
retry_failed = TRUE,
max_retries = 3
)
series |
Character vector of series names to fetch, or "all" (default)
for all available series. Use |
theme |
Character vector of themes to filter by. Valid options: "labor_market", "earnings", "demographics", "social_protection", "prices". Use NULL for no filter. |
theme_category |
Character vector of theme categories to filter by. Use NULL for no filter. |
subcategory |
Character vector of subcategories to filter by. Use NULL for no filter. |
exclude_derived |
Logical. If TRUE, exclude series marked as derived (is_derived = TRUE in metadata). Default FALSE for backward compatibility. Derived series (rates) are computed from other series during mensalization, so excluding them saves API calls when fetching for mensalization. |
use_cache |
Logical. Use cached data if available? Default FALSE.
When TRUE, shows the date when data was cached (may be outdated).
Use |
verbose |
Logical. Print progress messages? Default TRUE. |
retry_failed |
Logical. Retry failed series downloads? Default TRUE. |
max_retries |
Integer. Maximum retry attempts per series. Default 3. |
Rolling quarters are labeled by their ending month:
201201 = Nov 2011 - Jan 2012 (mesnotrim = 1)
201202 = Dec 2011 - Feb 2012 (mesnotrim = 2)
201203 = Jan - Mar 2012 (mesnotrim = 3)
201204 = Feb - Apr 2012 (mesnotrim = 1)
etc.
The mesnotrim column indicates the month's position within its rolling
quarter, which is essential for the mensalization algorithm.
A data.table with columns:
Integer. YYYYMM of rolling quarter end month
Integer. Month position in quarter (1, 2, or 3)
Numeric. One column per requested series
SIDRA API may have rate limits. The function includes automatic retry logic with exponential backoff for failed requests.
get_sidra_series_metadata for available series names and metadata
mensalize_sidra_series to convert to exact months
rq <- fetch_sidra_rolling_quarters(
series = c("taxadesocup", "popocup", "popdesocup")
)
head(rq)
rq_labor <- fetch_sidra_rolling_quarters(theme = "labor_market")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.