This is a quick way to create a choropleth sketch of town-, neighborhood-, or tract-level data. Uses a corresponding sf
object; as of June 2018, this sf
object must be one that ships with this package, or otherwise be globally available.
quick_map(
data,
name = name,
value = value,
level = c("town", "neighborhood", "tract"),
city = NULL,
n = 5,
palette = "GnBu",
title = NULL,
...
)
A data frame containing data by geography.
Bare column name of location names to join; defaults name
.
Bare column name of numeric values to map; defaults value
.
String giving the desired geographic level; must be one of "town"
, "neighborhood"
, or "tract"
. Defaults "town"
.
If geographic level is neighborhood, string of the corresponding city name to match to a spatial object.
Number of breaks into which to bin values; defaults (approximately) 5.
String of a ColorBrewer palette; see RColorBrewer::RColorBrewer()
for possible values. Defaults "GnBu"
.
String giving the title, if desired, for the plot.
Any other parameters to pass along to geom_sf()
, such as color
or size
.
A ggplot
if (FALSE) {
tidycensus::get_acs(geography = "county subdivision",
variables = c(median_age = "B01002_001"), state = "09", county = "009") |>
town_names(NAME) |>
dplyr::filter(NAME %in% regions$`Greater New Haven`) |>
quick_map(name = NAME, value = estimate, title = "Median age by town, 2017", n = 6)
}