Income Data Map
This map displays information about income in Lancaster County, Pennsylvania. While statistical data is very important, a graph of the data is an introduction that most people can follow. The purpose of a data map is to illustrate data but we still need some typical map information such as roads and landmarks to help locate boundaries for data areas such as census tracts and zip codes.
Download Census Data
gis_tracts <- tracts(state = 'PA', county = c('Lancaster '))
income_data <- acs.fetch(endyear = 2014, geography = geo.make(state = "PA",
county = "Lancaster", tract = "*"),
variable = "B19013_001", key=censusapikey)
Layered Maps made with Leaflet
In order to plot census data on the map we make a layered map using the Leaflet package. This will allow us to add census tract areas such as polygons below. The basic leaflet addTiles() function includes some roads and landmarks to help locate areas on the map. There are many alternatives to the basic addTiles layout from other mapmakers. Here is the default map before adding the income data. We have zoomed-in in order to see where New Holland is located.
nh <- leaflet() %>%
addProviderTiles(providers$OpenStreetMap) %>%
addPopups(-76.11, 40.112,
"New Holland, Pennsylvania",
options = popupOptions(closeButton = FALSE)) %>%
setView(xlong, ylat, zoom = 12)
nh