| cnefe_counts | R Documentation |
cnefe_counts() reads CNEFE records for a given municipality, assigns
each address point to spatial units (either H3 hexagonal cells or user-provided
polygons), and returns per-unit counts of COD_ESPECIE as addr_type1 to
addr_type8.
cnefe_counts(
code_muni,
year = 2022,
polygon_type = lifecycle::deprecated(),
polygon = NULL,
crs_output = NULL,
h3_resolution = 9,
verbose = TRUE,
cache = TRUE,
cache_dir = NULL,
backend = c("duckdb", "r")
)
code_muni |
Integer. Seven-digit IBGE municipality code. |
year |
Integer. The CNEFE data year. Currently only 2022 is supported. Defaults to 2022. |
polygon_type |
|
polygon |
An |
crs_output |
The CRS for the output object. Only used when |
h3_resolution |
Integer. H3 grid resolution (default: 9). Only used for
the H3 grid, so it is ignored when |
verbose |
Logical; if |
cache |
Logical. If |
cache_dir |
Character. Directory to use for cached downloads. If |
backend |
Character.
If the constraint is memory rather than installability, keep the DuckDB
backend and cap it with the |
The counts in the columns addr_type1 to addr_type8 correspond to:
addr_type1: Private household (Domicílio particular)
addr_type2: Collective household (Domicílio coletivo)
addr_type3: Agricultural establishment (Estabelecimento agropecuário)
addr_type4: Educational establishment (Estabelecimento de ensino)
addr_type5: Health establishment (Estabelecimento de saúde)
addr_type6: Establishment for other purposes (Estabelecimento de outras finalidades)
addr_type7: Building under construction or renovation (Edificação em construção ou reforma)
addr_type8: Religious establishment (Estabelecimento religioso)
All eight types are reported. In particular, addr_type7 is retained here,
whereas compute_lumi() excludes it when computing land-use mix indices.
An sf::sf object containing:
id_hex (when polygon is NULL): H3 cell identifier
Original columns from polygon (when polygon is supplied)
addr_type1 ... addr_type8: counts per address type
geometry: polygon geometry
When polygon is supplied, the output CRS matches the original polygon CRS
(or crs_output if specified).
compute_lumi() for land-use mix indices on the same spatial units.
# Count addresses per H3 hexagon (resolution 9)
hex_counts <- cnefe_counts(code_muni = 2929057, cache = FALSE)
# Count addresses per user-provided polygon (neighborhoods of Lauro de Freitas-BA)
# Using geobr to download neighborhood boundaries
library(geobr)
nei_ldf <- subset(
read_neighborhood(year = 2022),
code_muni == 2919207
)
nei_counts <- cnefe_counts(
code_muni = 2919207,
polygon = nei_ldf,
cache = FALSE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.