quick_map | R Documentation |
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,
...
)
data |
A data frame containing data by geography. |
name |
Bare column name of location names to join; defaults |
value |
Bare column name of numeric values to map; defaults |
level |
String giving the desired geographic level; must be one of |
city |
If geographic level is neighborhood, string of the corresponding city name to match to a spatial object. |
n |
Number of breaks into which to bin values; defaults (approximately) 5. |
palette |
String of a ColorBrewer palette; see |
title |
String giving the title, if desired, for the plot. |
... |
Any other parameters to pass along to |
A ggplot
## Not run:
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)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.