cnefetools 0.2.3
CRAN release: 2026-03-06
Fixed missing hexagons at the edges of the H3 grid.
h3jsr::polygon_to_cells()only returns hexagons whose centroid falls inside the municipality boundary, so border hexagons that overlap the boundary without their center being inside were silently excluded.build_h3_grid()now adds those hexagons by checking the immediate neighbors of the grid against the municipality boundary (#62).cnefe_counts()andcompute_lumi()now expose acacheparameter (defaultTRUE), consistent withtracts_to_h3()andtracts_to_polygon()(#58).New
clear_cache_muni()function to delete cached CNEFE ZIP files from the user cache directory, with optional filtering by municipality code (#59).New
clear_cache_tracts()function to delete cached census tract Parquet files, with optional filtering by state (UF) code (#59).
cnefetools 0.2.2
CRAN release: 2026-02-27
- Resubmission to CRAN following package removal on 2026-02-26.
- No functional changes. Retains the
skip_on_cran()fix from v0.2.1 for the DuckDB spatial extension segfault on r-devel-linux-x86_64-fedora-clang.
cnefetools 0.2.1
CRAN release: 2026-02-13
- Adds
skip_on_cran()totest-tracts_to_h3.Rto prevent a segfault on r-devel-linux-x86_64-fedora-clang caused by an ABI mismatch between the clang-compiled DuckDB binary and GCC-built spatial extension (duckdb/duckdb-r#1107).
cnefetools 0.2.0
CRAN release: 2026-02-11
New functions
- New
tracts_to_polygon()for dasymetric interpolation from census tracts to user-supplied polygons, using CNEFE dwelling points as ancillary data. - New
tracts_variables_refreference table mapping cnefetools variable names to official IBGE census tract codes.
Major changes
-
hex_cnefe_counts()has been renamed tocnefe_counts(). The function now accepts user-supplied polygons viapolygon_type = "user"in addition to H3 hexagons (polygon_type = "hex", default). -
compute_lumi()gains support for user-supplied polygons via the samepolygon_typeparameter, and a new land-use mix indicator: ICE (Index of Concentration at Extremes). -
tracts_to_h3()andtracts_to_polygon()gain five new interpolation variables related to race:race_branca,race_preta,race_parda,race_amarelaandrace_indigena. -
read_cnefe(),cnefe_counts(),compute_lumi(), andtracts_to_h3()gain ayearargument (default2022) to prepare for future CNEFE editions.
Improvements
- All user-facing functions now use the cli package (>= 3.6.0) for formatted console messages, replacing plain
message()calls. - Improved diagnostic output in
tracts_to_h3()andtracts_to_polygon()with two-stage reporting structure. - Census tract Parquet assets are now downloaded via piggyback from GitHub Releases, with on-demand caching.
Bug fixes
- Removed inconsistencies in spatial join operations in
cnefe_counts(),compute_lumi(), andtracts_to_polygon()with DuckDB. - Fixed community extension loading failures in DuckDB.
- Fixed temporary file path bugs in
tracts_to_h3()andtracts_to_polygon(). - Fixed invalid geometry handling when user-supplied polygons.
cnefetools 0.1.1
- Adds Balance Index (BAL),
balto thecompute_lumi()function.
cnefetools 0.1.0
- New:
tracts_to_h3()for dasymetric interpolation from tract aggregates to CNEFE dwelling points and H3 hexagons using DuckDB (spatial + h3). - Added UF-level census tract Parquet assets (WKB geometry) hosted on GitHub Releases and downloaded on-demand with caching.
cnefetools 0.0.6
- Moves DBI and duckdb to Imports so the DuckDB backend works out of the box
- Removes silent fallback to
backend = "r"whenbackend = "duckdb"is requested - No changes to outputs; behavior is unchanged aside from dependency handling
cnefetools 0.0.5
- Makes unit tests more reproducible and CI-friendly by removing dependencies on network access and local cache state (offline ZIP fixture and mocked downloads)
- Improves robustness of
read_cnefe(output = "sf")by handling missing coordinates before converting tosf - Updates
COD_ESPECIEdocumentation and removes tidyselect deprecation warnings in tests and internals
cnefetools 0.0.4
- Major speed-up for H3 assignment and hex-level aggregation via DuckDB + H3 extension (SQL), with runtimes dropping from minutes to seconds for large municipalities
- Adds a configurable backend with backwards compatibility:
backend = "duckdb"(default) orbackend = "r"forhex_cnefe_counts()andcompute_lumi() - Refactors internals to reuse cached ZIPs and consolidate common helpers, reducing repeated overhead and improving maintainability
cnefetools 0.0.3
- More robust downloads with retry logic and increased timeout when needed
- Avoids leaving partial or corrupted ZIP files in the cache
- Automatically detects corrupted cached ZIPs and re-downloads before extraction
cnefetools 0.0.2
- Add
compute_lumi()to compute land-use mix indicators (EI, HHI, adapted HHI, BGBI) on H3 grids. - Extend README with examples for Fortaleza (code 2304400) and BGBI maps.