| output | github_document |
|---|
comarcasBR provides data on Brazilian judicial districts (comarcas), including which municipalities each comarca covers, socioeconomic and judicial indicators from IPEA's Atlas do Estado, and comarca boundary shapefiles built on top of geobr.
You can install the development version of comarcasBR from GitHub like so:
# install.packages("pak")
pak::pak("rmhirota/comarcasBR")Look up which comarca a municipality belongs to, by IBGE code or name:
library(comarcasBR)
get_comarca(3550308) # São Paulo, by IBGE code
#> # A tibble: 1 × 2
#> cod_mun_ibge_comarca nome_comarca
#> <dbl> <chr>
#> 1 3550308 São Paulo
get_comarca("São Paulo") # São Paulo, by name
#> ℹ Using year/date 2022
#> # A tibble: 1 × 2
#> cod_mun_ibge_comarca nome_comarca
#> <dbl> <chr>
#> 1 3550308 São PauloBuild comarca boundaries for a state, joining municipality geometries into their comarcas:
sp <- read_comarcas("SP")
#> ℹ Using year/date 2023
sp |>
ggplot2::ggplot() +
ggplot2::geom_sf(ggplot2::aes(fill = n_municipios))The package also bundles ready-to-use datasets: municipios,
comarcas, and geo_comarcas.
