knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.align = "center" )
library(brazilmaps)
Every map returned by get_brmap() is installed with the package. No example
in this vignette accesses the network.
states <- get_brmap("state") states
The default municipal map is the newest installed edition:
latest_year <- max(brmap_editions()$year) latest <- get_brmap("municipality") stopifnot(unique(latest$year) == latest_year)
A named list can contain one or several constraints. Constraints are combined with AND, so the following result contains only municipalities that satisfy both conditions:
ms <- get_brmap( "municipality", filters = list(region = 5, state = 50) ) unique(ms[c("region_code", "state_code")])
data("gini2015") plot_brmap( states, data = gini2015, by = c("state_code" = "cod"), fill_by = "gini" )
For full control, use the returned object directly with ggplot2::geom_sf().
get_dtb(name = "Campo Grande") get_dtb_levels( c("municipality", "immediate_region"), filters = list(state = 50) )
microregion and mesoregion are retained as discontinued historical IBGE
divisions. immediate_region and intermediate_region are the current
regional divisions.
Legacy sp output remains available with output = "sp" when package sp is
installed. New code should use the default sf output.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.