urbnmapr makes a few variations of the same basic map.
The package lives on GitHub. The devtools
package makes it easy to install straight from the source.
devtools::install_github("UrbanInstitute/urbnmapr")
states <- get_urbn_map(map = "states", sf = TRUE)
## state_fips state_abbv state_name geometry
## 1 01 AL Alabama MULTIPOLYGON (((1150023 -15...
## 2 02 AK Alaska MULTIPOLYGON (((-1273178 -2...
## 3 04 AZ Arizona MULTIPOLYGON (((-1386136 -1...
## 4 05 AR Arkansas MULTIPOLYGON (((482001 -928...
## 5 06 CA California MULTIPOLYGON (((-1717278 -1...
You can merge your data onto this dataframe to make choropleth maps.
geographic_data <- left_join(states, statedata,
by = "state_name")
ggplot() +
geom_sf(data = geographic_data,
mapping = aes(fill = medhhincome),
color = "white") +
scale_fill_gradientn(labels = scales::dollar) +
coord_sf(datum = NA) +
urbnthemes::theme_urbn_map() +
labs(fill = "Median household income")
Mapping individual states
Custom layouts for specific projects
Visit the urbnmapr GitHub page for more detailed instructions.
The Urban Institute mapping guide is currently in progress!
Reproducibility
Make the same map 100 times
It’s free
Geospatial analysis in R is constantly evolving
Portable
Lowers the barrier to entry
Push updates when we need to
Cool hex stickers
We create tools to help researchers do their jobs more efficiently- whether it is running trainings, building packages, or writing detailed guides.
You can follow along: