Analyzing Raleigh's Hospitals for Accessibility Through Public Transport

Joseph Henry-Penrose for COM 329

Introduction:

Raleigh is known as one of the more accessible cities in North Carolina. To be fair, that's not saying much. However, I wanted to see just how accessible hospitals and police stations, two of the most necessary public amenities, are through the bus system.

My Hypothesis: Any hospitals within the vicinity to metropolitan areas will have several lines passing through each hospital and at least one line passing by each police station. However, as hospitals and police stations move to suburbs, this level of accessibility will decrease. Finally, hospitals and police stations in more rural areas will have no accessibility via bus.

All data was acquired through the Raleigh Open Data portal.

Importing & Cleaning Data:

To get started, we need to import all of our data. In this case, we're using data from the Raleigh Open Data Portal. Below is a list of each dataset needed and a link to download:

File Open Data Page Shapefile Direct Download
GoRaleigh Transit Routes: Open Data Shapefile
GoTriangle Transit Routes: Open Data Shapefile
GoDurham Transit Routes: Open Data Shapefile
GoCary Transit Routes: Open Data Shapefile
Hospital Locations: Open Data Shapefile
Police Department Locations: Open Data Shapefile

Once downloaded, unzip these files and place the full folders within your r workspace. You can place them inside their own folder if you'd like. In this case, I placed all of my files within a folder named "data" within my project file.

llibrary(sf)

library(maps)

library(tidyverse)

library(tigris)

install.packages("leaflet")

library(leaflet)

install.packages("ggthemes")

library(ggthemes)

install.packages("here")

library(here)

install.packages("mapview")

library(mapview)

install.packages("leafpop")

library(leafpop)

Now that we have our packages installed, let's load in our data. In this instance, replace the path of your folders with what I have as "data." Be sure to remove the space between "and_" and "Surrounding.shp" in this code.

goRaleigh_transit <- here("data/GoRaleigh_Transit_Routes/GoRaleigh_Transit_Routes.shp") %>% st_read()

hospitals <- here("data/Hospitals_Wake_County_and_Surrounding/Hospitals_Wake_County_and_ Surrounding.shp") %>% st_read()

hospitals_raleigh <- hospitals %>% filter(CITY == "Raleigh")

police_dpts <- here("data/Police_Departments/Police_Departments.shp") %>% st_read()

police_raleigh <- police_dpts %>% filter(MUNICIPALI == "Raleigh")

goCary <- here("data/gocaryroutes_20180201/GoCaryRoutes.shp") %>% st_read()

goDurham <- here("data/godurham_routes_20180201/GoDurham_Routes_20180201.shp") %>% st_read()

goTriangle <- here("data/gotriangle_routes_20190415/GoTriangle_Routes_20190415.shp") %>% st_read()

Making Maps

So, we have our shapefiles as data frames in r. Now what? Well, now we use mapviewer to craft some interactive maps. Most of our code is pretty repetitive here. We're asking mapviewer to read our data, set the line color custom to each city, customize what information appears when each point is clicked on, and customize what comes up when each point is hovered over. For the police departments and hospitals, we set the fill of each point to either blue or red. Finally, we remove the legend for simplicity.

mapview(goCary, color = "#6BAB90", layer.name = "goCary", popup = popupTable(goCary, zcol = c("Route_ID", "Route_Name")), zcol = "Route_ID", legend = FALSE) +

mapview(goDurham, color = "#48A9A6", layer.name = "goDurham", popup = popupTable(goDurham, zcol = c("LineAbbr", "LineName")), zcol = "LineAbbr", legend = FALSE) +

mapview(goTriangle, color = "grey", layer.name = "goTriangle", popup = popupTable(goTriangle, zcol = c("LineAbbr", "LineName")), zcol = "LineAbbr", legend = FALSE) +

mapview(goRaleigh_transit,color = "#E5A7AD", layer.name = "goRaleigh Bus", popup = popupTable(goRaleigh_transit, zcol = c("LineAbbr", "LineName")), zcol = "LineAbbr", legend = FALSE) +

mapview(hospitals, color = "#FF3C38", col.regions = "#FF3C38", layer.name = "Police Stations",popup = popupTable(hospitals_raleigh, zcol = c("ADDRESS", "CITY", "NAME", "SERVICES")), zcol = "NAME", legend = FALSE) +

mapview(police_dpts, color = "#457B9D", col.regions = "#457B9D", layer.name = "Hospitals", popup = popupTable(police_raleigh, zcol = c("SITE_ADDRE", "MUNICIPALI", "TYPE_STATI")), zcol = "SITE_ADDRE", legend = FALSE)

This will create a map that has all of the Triangle's public bus lines, all hospitals, and all police stations in Raleigh. Hospitals are red circles, police stations are blue circles. Each city has its own separate color (Raleigh is pink, Durham is teal, Cary is green, and goTriangle is grey).

Click on each button in the bottom right of the map to focus on that specific data set.

We can see from this that our hypothesis seems quite correct. All hospitals and police departments within Raleigh, Durham, and Chapel Hill are serviced by two or more bus lines. As we move further out into suburbs, this declines to one bus line. In rural areas, most hospitals are not serviced by any public transport. Some quick research on Dunn, Granville, and Smithfield show that there is no bus to and from these hospitals.

What about just Raleigh?

Now let's look at Raleigh on its own so we can narrow things down.

Once again, hospitals are red circles, police stations are blue circles. Each city has its own separate color (Raleigh is pink, Durham is teal, Cary is green, and goTriangle is grey).

mapview(hospitals_raleigh, color = "#FF3C38", col.regions = "#FF3C38", layer.name = "Police Stations", popup = popupTable(hospitals_raleigh, zcol = c("ADDRESS", "CITY", "NAME", "SERVICES")), zcol = "NAME", legend = FALSE) +

mapview(police_raleigh, color = "#457B9D", col.regions = "#457B9D", layer.name = "Hospitals", popup = popupTable(police_raleigh, zcol = c("SITE_ADDRE", "MUNICIPALI", "TYPE_STATI")), zcol = "SITE_ADDRE", legend = FALSE) +

mapview(goRaleigh_transit,color = "#E5A7AD", layer.name = "goRaleigh Bus", popup = popupTable(goRaleigh_transit, zcol = c("LineAbbr", "LineName")), zcol = "LineAbbr", legend = FALSE)

Click on each button in the bottom right of the map to focus on that specific data set.

Again, the hypothesis holds up here. Hospitals closer to Central and Downtown Raleigh are serviced by two bus lines, while those in North Raleigh only have one. This trend continues for police stations.

Conclusion:

Overall, it appears that my hypothesis has been proven correct; hospitals and police stations in urban and suburban areas are directly serviced by one or more buses while hospitals and police stations in more rural areas are not directly serviced.

It is worth noting that, from this analysis alone, we cannot see which came first, making this a sort of chicken or egg situation. Hospitals and police stations may have been built in their respective locations due to proximity to public transport or, more likely, transport routes may have been created to service these locations.

Future Exploration:

While shapefiles exist of Durham and Chapel Hill's police departments, most of it is only available to Duke students. Access to these files would allow me to easily compare accessibility in Raleigh to Durham for police stations and hospitals.

I also think that it would be incredibly interesting to compare the types of restaurants that are most accessible by bus in each city.