Skip to content

Latest commit

 

History

History
68 lines (49 loc) · 1.63 KB

File metadata and controls

68 lines (49 loc) · 1.63 KB
output github_document

comarcasBR

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.

Installation

You can install the development version of comarcasBR from GitHub like so:

# install.packages("pak")
pak::pak("rmhirota/comarcasBR")

Example

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 Paulo

Build 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))
plot of chunk plot-example

plot of chunk plot-example

The package also bundles ready-to-use datasets: municipios, comarcas, and geo_comarcas.