ibger 0.2.1
- The package was peer-reviewed and accepted by rOpenSci (ropensci/software-review#787). The repository moved to https://github.com/ropensci/ibger and the documentation to https://docs.ropensci.org/ibger/; the rOpenSci Code of Conduct now applies.
Changes from the rOpenSci review (ropensci/software-review#787)
Second review (@ddiannae)
-
parse_sidra_url()/fetch_sidra_url(): a SIDRA URL without a/p/(periods) segment no longer crashes the print method and the fetch; the equivalent call falls back to theibge_variables()default (last 6 periods) (reported by @ddiannae). -
parse_sidra_url(): a territorial level that is not in the internal lookup table (e.g.n12) no longer errors with “subscript out of bounds”. Levels that the aggregate does not offer now raise a warning at parse time listing the available levels, andfetch_sidra_url()fails through the regular validation (reported by @ddiannae). -
parse_sidra_url(): URLs with several territorial levels (e.g.n1/all/n3/all) produced an “Equivalent ibger call” with an unnamed list thatibge_variables()rejects. The printed call andfetch_sidra_url()now share one translation: a named list when every level has specific codes, and the API’s pipe syntax ("N1|N3[33,35]") otherwise (reported by @ddiannae). -
ibge_aggregates()now checks the format of its five filters before the request. The API silently drops filters it cannot parse (returning the whole catalog under a success message) and answers HTTP 500 to others, e.g.periodicity = 30; malformed values now abort with an example of the expected format. An empty result is reported with a warning instead of a green “0 aggregates found”, and keeps the documented columns (reported by @ddiannae). -
ibge_aggregates(): the periodicity codes in the documentation were wrong (P10andP58do not exist;P13is the rolling quarter, not annual). The documented table now lists the codes observed in the catalog:P1annual,P5monthly,P8semi-annual,P9quarterly,P13rolling quarter, plus the multi-year codes (reported by @ddiannae). -
ibge_localities()with several levels queries each level separately and binds the results: the API’s own multi-level endpoint returns an empty list as soon as one of the levels has no localities for the aggregate. An empty result now keeps the documented columns and is reported with a warning (reported by @ddiannae). - The “exceeds the 100,000 value limit” hint on HTTP 500 is now only shown for data requests (
ibge_variables()); for the other endpoints, where a 500 means the API could not interpret the request (non-existent aggregate, invalid filter), the message says so (reported by @ddiannae). - Vignettes:
getting-startedandapi-conceptsare now precomputed against the live API like the other two (vignettes/precompile.R), so every printed output is real. This removed a set of wrong hand-written outputs — aggregate 1705 (IPCA-15) was described as the quarterly animal slaughter table, which is 1092; theibge_variables(1705, localities = "N3")example (also in?ibge_variables) errors because 1705 has no state level;periodicity = "P10"returned nothing — and replaced the advice to split large queries by hand with a section on the automatic chunking (chunk) in all three vignettes that mentioned the limit (reported by @ddiannae; precomputing suggested by @beatrizmilz). -
ibge_localities()example:ibge_localities(1437, level = c("N6", "N7"))returned an empty tibble (1437 has no metropolitan-area localities); the example now usesc("N2", "N3")(reported by @ddiannae).
First review (@allanvc)
Fixed the
bsiconsavailability check inibge_explorer(), which told users to installbslibinstead ofbsicons(reported by @allanvc).Fixed the documentation of the
launch.browserargument ofibge_explorer(), which describedFALSEas the default; the default is and remainsTRUE(open in the browser), andFALSEopens the app in the RStudio Viewer pane (reported by @allanvc).Documented the IBGE API’s server-side latency for large queries in
?ibge_variablesand the README: municipality-level requests can take one to several minutes each (suggested by @allanvc).README: replaced the link to IBGE’s terms of use, whose old address now returns a 404, with the current “Termo de Uso e Política de Privacidade” page (reported by @allanvc).
Removed the stray
.Rhistoryfile from the repository (suggested by @allanvc).curl (>= 6.0.0)is now declared inImports, enforcing at install time the version requirement that was previously only documented in the README (older curl versions fail withcurl_modify_url is not an exported object).The table of IBGE special value codes (
-,..,...,X) is now documented in a single place —?parse_ibge_value— and linked from the README and vignettes instead of being repeated.The
ipca-exampleandtutorialvignettes are now precompiled from.Rmd.origsources against the live IBGE API (vignettes/precompile.R), so their output and ggplot2 figures render on the pkgdown site.README: added the rOpenSci review badge, linked the API-concepts vignette from the quick start, pointed the “Value column” section to
parse_ibge_value(), and rewrote theibge_explorer()section to match the tone of the rest of the page.Examples no longer use
\dontrun{}: examples that query the live IBGE API (or launch the Shiny explorer) are now guarded with@examplesIf interactive(), so they render in the docs and run for interactive users without hitting the network during checks.Internal refactor to address the remaining pkgcheck/goodpractice notes: every function is now below the cyclomatic-complexity threshold of 15 (long functions such as
parse_sidra_url(),fetch_sidra_url(),ibge_metadata()andibge_survey_metadata()were decomposed into focused helpers), duplicated@paramdocs were replaced with@inheritParams, and the lintr issues flagged in the review (long lines,expect_equal()vsexpect_identical(), static regexes withoutfixed = TRUE, duplicateclibullet names,<<-,require()in the Shiny app,setwd()inprecompile.R) were cleaned up. No user-facing behavior changes.
Other changes
- Expanded the test suite to cover all exported functions (~85% coverage): pure helpers and parsers are tested directly, and API interactions are tested against recorded fixtures with
httptest2(no network needed). - Added continuous integration:
R CMD checkon Linux/macOS/Windows and test coverage reporting via GitHub Actions. - Added
CONTRIBUTING.md,CODE_OF_CONDUCT.mdandcodemeta.jsonin preparation for rOpenSci submission.
ibger 0.2.0
CRAN release: 2026-07-08
-
ibge_variables()gains achunkargument (defaultTRUE): queries whose estimated result exceeds the API’s value limit are now transparently split into multiple smaller requests (by periods, then by localities) and combined into a single tibble, instead of failing with HTTP 500 (#1, @danielvartan). Usechunk = FALSEto disable, or a positive number for a custom per-request limit. The documented API limit is 100,000 values, but empirically requests fail above ~50,000, so that is the default. - Period and locality id lists fetched for chunking are cached per session (cleared by
ibge_clear_cache()). - Initial test suite (testthat) covering the chunking logic.
ibger 0.1.0
CRAN release: 2026-02-20
- Initial CRAN release.
- Core functions:
ibge_aggregates(),ibge_metadata(),ibge_periods(),ibge_localities(),ibge_variables(). - Pre-flight validation against aggregate metadata for all query parameters.
- In-memory metadata cache with
ibge_clear_cache(). -
parse_ibge_value()utility for converting IBGE special value codes. -
parse_sidra_url()andfetch_sidra_url()for migrating from SIDRA API URLs (e.g. from the Query Builder or sidrar package). - Support for flat view (
view = "flat") response parsing. - Four vignettes: getting started, API concepts, IPCA example, and a real-world tutorial on tracking state GDP components.