Skip to content

ibger: Access the IBGE Aggregate Data API from R #787

Description

@milkway

Submitting Author Name: André Leite
Submitting Author Github Handle: @milkway
Other Package Authors Github handles: (comma separated, delete if none) @marcoswasiliew, @hugoavmedeiros, @cagaf, @DiCarvalhoB
Repository: https://github.com/StrategicProjects/ibger
Version submitted: 0.2.0
Submission type: Standard
Editor: @beatrizmilz
Reviewers: @allanvc, @ddiannae

Due date for @allanvc: 2026-08-28

Due date for @ddiannae: 2026-09-04
Archive: TBD
Version accepted: TBD
Language: en


  • Paste the full DESCRIPTION file inside a code block below:
Package: ibger
Title: Access the 'IBGE' Aggregate Data API from 'R'
Version: 0.2.0
Authors@R: c(
    person("Andre", "Leite", email = "leite@castlab.org", role = c("aut", "cre"),
           comment = c(ORCID = "0000-0002-4718-9766")),
    person("Marcos", "Wasiliew", email = "marcos.wasilew@gmail.com", role = "aut"),
    person("Hugo", "Vasconcelos", email = "hugo.vasconcelos@ufpe.br", role = "aut",
           comment = c(ORCID = "0000-0001-6249-0920")),
    person("Carlos", "Amorim", email = "carlos.agaf@ufpe.br", role = "aut",
           comment = c(ORCID = "0000-0001-6315-8305")),
    person("Diogo", "Bezerra", email = "diogo.bezerra@ufpe.br", role = "aut",
           comment = c(ORCID = "0000-0002-1216-8674")))
Description: 'Tidyverse'-friendly interface to the Brazilian Institute of Geography and Statistics ('IBGE') aggregate data 'API' 
    <https://servicodados.ibge.gov.br/api/docs/agregados?versao=3>. Query aggregates, variables, localities, periods, and metadata
    from surveys and censuses conducted by 'IBGE'.
License: MIT + file LICENSE
URL: https://github.com/StrategicProjects/ibger,
    https://strategicprojects.github.io/ibger/
BugReports: https://github.com/StrategicProjects/ibger/issues
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
Depends: 
    R (>= 4.1.0)
Imports: 
    httr2 (>= 1.0.0),
    cli (>= 3.6.0),
    tibble,
    purrr,
    dplyr,
    rlang,
    glue
Suggests:
    knitr,
    rmarkdown,
    pkgdown,
    ggplot2,
    tidyr,
    shiny (>= 1.8.0),
    DT,
    bslib (>= 0.6.0),
    bsicons,
    rstudioapi,
    testthat (>= 3.0.0),
    httptest2,
    withr
Config/testthat/edition: 3
VignetteBuilder: knitr
Config/roxygen2/version: 8.0.0

Scope

  • Please indicate which category or categories from our package fit policies this package falls under: (Please check an appropriate box below. If you are unsure, we suggest you make a pre-submission inquiry.):

    • data retrieval
    • data extraction
    • data munging
    • data deposition
    • data validation and testing
    • workflow automation
    • version control
    • citation management and bibliometrics
    • scientific software wrappers
    • field and lab reproducibility tools
    • database software bindings
    • geospatial data
    • translation
    • rOpenSci internal tools
  • Explain how and why the package falls under these categories (briefly, 1-2 sentences):

    ibger retrieves Brazil's official statistics — census tables and recurring demographic, economic, social and agricultural surveys — from the Brazilian Institute of Geography and Statistics (IBGE) Aggregates API v3, returning tidy tibbles ready for analysis. It also covers the IBGE Metadata API (survey catalog and methodological documentation).

  • Who is the target audience and what are scientific applications of this package?

    Researchers, statistical agencies, journalists and public-policy analysts working with Brazilian official statistics. Scientific applications include reproducible access to indicators such as consumer price inflation (IPCA), municipal GDP, census population counts and agricultural production series, at any geographic level from the whole country down to its 5,570 municipalities. The package grew out of the production needs of Pernambuco's Strategic Monitoring Data Science Team (doi:10.59490/dgo.2025.925).

  • Are there other R packages that accomplish the same thing? If so, how does yours differ or meet our criteria for best-in-category?

    sidrar is the closest package. It accesses the legacy SIDRA API and inherits its constraints: a 20,000-value per-request limit with no built-in work-around, metadata discovery via HTML scraping, no pre-flight validation, and positional string-coded parameters. ibger uses the modern Aggregates API v3 (structured JSON metadata endpoints) and differs in three main ways: (1) parameters are validated against cached table metadata before any request, producing informative errors that list allowed values; (2) large queries are automatically split into multiple requests and combined (the API rejects requests above ~50,000 values in practice), removing the practical size ceiling; and (3) parse_sidra_url()/fetch_sidra_url() translate legacy SIDRA URLs into equivalent ibger calls, easing migration from sidrar scripts and the SIDRA Query Builder. A detailed comparison table is in the README. Packages such as PNADcIBGE/SIPDIBGE target survey microdata, a different data product; geobr covers spatial data and censobr census microdata — none accesses the SIDRA aggregate tables. A Python sibling with a mirrored API is maintained by the same team (https://github.com/StrategicProjects/ibgepy).

  • (If applicable) Does your package comply with our guidance around Ethics, Data Privacy and Human Subjects Research?

    Not applicable: the package retrieves aggregate, public, official statistics only (no microdata or personal data). IBGE itself suppresses disclosive cells (code "X"), which parse_ibge_value() preserves as NA.

  • If you made a pre-submission inquiry, please paste the link to the corresponding issue, forum post, or other discussion, or @tag the editor you contacted.

    None.

  • Explain reasons for any pkgcheck items which your package is unable to pass.

    All pkgcheck items pass. One note: most function examples use \dontrun{} because every fetch function calls the live IBGE API; offline behaviour is instead covered by the test suite, which runs against recorded httptest2 fixtures (~87% coverage, reported on Codecov). Happy to convert examples to @examplesIf interactive() if preferred.

Technical checks

Confirm each of the following by checking the box.

This package:

Use of Generative AI

  • Generative AI tools were used to produce some of the material in this submission.

Claude Code (Anthropic) was used as a development assistant: it helped scaffold the httptest2-based test suite (fixtures recorded from live IBGE API responses), draft and revise documentation and vignettes, prepare the accompanying JOSS paper.md, and draft this submission text. All AI-assisted material was reviewed by the human authors and validated through R CMD check, the test suite, and rOpenSci pkgcheck.

Publication options

  • Do you intend for this package to go on CRAN? (already on CRAN, version 0.2.0)

  • Do you intend for this package to go on Bioconductor?

  • Do you wish to submit an Applications Article about your package to Methods in Ecology and Evolution?

We intend to submit the accompanying short paper (paper.md in the package root) to the Journal of Open Source Software after the rOpenSci review process is over, per the rOpenSci–JOSS collaboration.

Code of conduct

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions