4 – Access to Subway Lines for Low-income neighborhoods

1. Introduction

In Lesson 2, we looked at ridership and discussed how it is a popular measure of success. However, we also mentioned that coverage of the system could be an equally valid mission of a transit system. Coverage is essential for many reasons, including providing access to jobs and services.

The report “Mobility, Economic Opportunity and New York City Neighborhoods” produced by NYU’s Rudin Center for Transportation analyzes the connection between neighborhoods and commuting to jobs in New York City. The study ranked neighborhoods by the number of jobs reachable within a 60-minute travel time before 9:00 a.m. on Mondays using public transportation. Among their findings, neighborhoods with the most access to jobs have higher median income, and neighborhoods with low access typically have higher rates of car commuting.

In Massachusetts, the Executive Office of Energy and Environmental Affairs (EEA) created an Environmental Justice Policy to address communities who are disproportionally impacted by environmental risks. The communities were identified using the following factors: income, national origin, race, color, and English proficiency.
The following thresholds define environmental Justice Populations:
– 25% of household within the census block group with a median annual household income at or below 65% the statewide median
– 25% or more residents are a minority
– 25% or more residents have English Language Isolation, households with members over 14 years old who speak another language and have limited English language skills.

MassGIS identified these populations by census block and provided a shapefile containing these Environmental Justice blocks. These neighborhoods are also useful to examine issues that go beyond the environment.
This lesson looks at the connection between the location of MBTA subway stations and their accessibility from Environmental Justice census blocks identified as lower-income. The connection is important because access to a rapid-transit station increases the range of accessible jobs and services. Subway stations often attract business and services to a community as well.

2. Learning Outcomes

  • Understand how to use coverage and accessibility to evaluate transit systems
  • Locate MBTA station location data and Environmental Justice Census Block data
  • Create a map of the walkability of MBTA subway stations from Environmental Justice neighborhoods

3. Finding Data

We will be using MassGIS Environmental Justice Census Blocks. We’ll also use the MBTA station data we created from Lesson 1 – Mapping a Transit System. You can also download the station data here.

4. Set Up

      • Create a Working Directory, a folder on your computer that is easily accessible.
      • Download the transit-data-toolkit file, which contains the R files. Open the zip file, and copy the 04-access-stations.R file to your Working Directory.
      • Copy your mbta_stops that we exported in Lesson 1 to your Working Directory, or you can download it.
      • Go to the MassGIS website and download the Environmental Justice Populations file called ej2010.zip.
      • Move the ej2010.zip file to your Working Directory and “unzip” the file. Go to the Getting Started Zip Files section if you need instructions on “unzipping” files.

5. Data Wrangling

      • Open RStudio.
      • If there are any files and data frames open from the last time you used R, close them by selecting File > Close All. Then, remove any Environment variables by selecting Sessions > Clear Workspace.
      • Open the file in RStudio, by selecting File > Open File > 04-access-stations.R.
      • Set your Working Directory. Select: Sessions > Set Working Directory > To Source File Location. To Source File Location sets your Working Directory folder as the default location for your current session in RStudio. RStudio looks for files without a file path at to this location.
      • As we have done in previous lessons, place the cursor on the first line of code. When ready, click on the Run button to execute a line of code. Also, recall comments are skipped over until the next line of R is reached.

We will use several packages in this lesson. One of the packages we will is Leaflet, which creates interactive maps. Although Leaflet is written in JavaScript, the Leaflet R Package offers Leaflet’s mapping features in RStudio. In this lesson, we also use Open Street Map as our basemap.

      • If you have not installed theses previously, install them now by placing the cursor at the first comment and clicking Run until all the packages are installed.

# Install packages (this is only required once)
install.packages('leaflet', dependencies = TRUE)
install.packages('maps', dependencies = TRUE)
install.packages('sp', dependencies = TRUE)
install.packages('rgdal', dependencies = TRUE)
install.packages('rgeos', dependencies = TRUE)

Next, we need to load the libraries we will use.

      • Click Run until all the libraries are loaded.

# Load Libraries
      • Next, load the Environmental Justice blocks into R.
      • Run the next three lines. The first line reads the Environmental Justice block shapefiles into a data frame. The second line transforms the data into the WGS84 projection to match our station location data. The third line opens the shapefile in the Source Pane.
      • Click on data to the information contained in the file.
      • Scroll down to find the INCOME variable. It has an I for low-income blocks and NA for other blocks.

#read in environmental justice blocks
ej_blocks <- readOGR("ej2010", "EJ_POLY")
ej_blocks <- spTransform(ej_blocks, CRS("+proj=longlat +datum=WGS84"))

Figure 1. ej_block shapefile in R

      • We are interested blocks which have been designed low income and have a value I in the INCOME column.
      • First, create a new data frame income_block which only contains the low-income blocks. Then, create assigned the color blue to our income blocks data and store it in the variable pal.
      • Click Run twice to run these two lines.

#select block designated as low income
income_blocks <- ej_blocks[ej_blocks$INCOME == "I" & !is.na(ej_blocks$INCOME), ]
pal <- colorFactor(palette = c("#E69F00"), domain = ej_blocks$INCOME)

Now, we can map our low-income neighborhood blocks using Leaflet. We create a map named access_map and using the addTiles function to add the Open Street Map basemap, and addPolygons to income_blocks with the assigned color.
Run the next two lines of R code to create the map, and then render the map in the Viewer tab in the bottom left RStudio Pane.

#make leaflet map
access_map = leaflet() %>% addTiles() %>%
addPolygons(data=income_blocks, weight=1, color = ~pal(INCOME), fillOpacity = 1)
      • Drag the map to the center of the Plots Pane and use the Zoom controls to view the blocks.

Figure 2. Leaflet Map of Boston’s Environmental Justice 2010 Census Blocks

5. Visualization

      • Run the next line of R to read the MBTA subway station locations data that we prepared in Lesson 1.

# Read in MBTA Station csv file from Lesson 1
station_locs <- read.csv(file="./mbta_stops.csv", head=TRUE,sep=",")
      • Click Run to execute the next line of R. This line converts to the longitude and latitude columns in our data frames into a spatial data format which we can map.

# Convert the longitude and latitue to spatial coordinates
coordinates(station_locs) <- ~longitude + latitude

Next, we add a quarter mile buffer around each station location. This buffer represents the approximated area within walking distance of the each MBTA subway station.

      • Click Run to execute the next line.

# Add a buffer of a 1/4 mile around the point
walking_distance_buffer <- gBuffer(station_locs, width=0.004, byid = TRUE)

Let’s add the station locations and buffer to our map.

      • First, click Run to add the same projection label WGS84 to our walking_distance_buffer data frame.

# Add projection WGS84
proj4string(walking_distance_buffer) <- "+proj=longlat +datum=WGS84"
      • Then, click Run to create our map with the 1/4 mile subway station buffer on top of our low-income neighborhoods. Click Run again to render the map in the Viewer Pane.

# make leaflet map
access_map = leaflet(station_locs) %>%
addTiles() %>%
addPolygons(data=income_blocks, weight=1, color = ~pal(INCOME), fillOpacity = 1) %>%
addCircleMarkers(radius=1, stroke=1, color="#0072B2") %>%

addPolygons(data=walking_distance_buffer, weight=1, color = "#0072B2", stroke = FALSE, fillOpacity = 0.5)

Figure 3. Area within 1/4 miles of a MBTA subway stations.

      • Our map is almost complete. Click Run twice to add a legend and render the final version of it.

# Add Legend
access_map = access_map %>% addLegend('bottomleft',
colors =c("#E69F00","#0072B2"),
labels= c("Low Income Blocks","1/4 mile Buffer"),
title= "Subway Access to Low Income Blocks",
opacity = 1)

Figure 4. Area within 1/4 miles of a MBTA subway stations in relation to and Low Income Neighborhoods.

6. Analysis
Look at our map. What areas lack service? What areas have an abundance of service? Based on the ridership and reliability maps we created, what new questions can we ask?

What does our analysis not include? One important aspect missing in our analysis is multi-modal travel. Many passengers take a bus and the subway on a trip. Accounting for bus connections increases the coverage of neighborhoods. Can you redraw the map accounting for bus stops with frequent service (every 15 minutes or more often) in addition to the subway stations?

Over the past four lessons examining the MBTA subway system, we have used transit data to explore ridership, reliability, and coverage. These interconnected concepts help us evaluate transit systems. Reliability affects ridership because more people will take the subway (or bus) rather than their car if they can depend on getting where they want to go on time. Considering both geographic coverage and ridership as measures for a successful transit system makes allocating finite resources more challenging. An understanding of both station reliability and coverage will deepen the evaluation of any transit system, as will an understanding of who is being served.

These lessons provide you with a foundation from which you can ask new questions. Answers may be found within these datasets, or may require additional data. For example, what insights could be gained by adding our reliability or ridership data to this map? What new data would you need to add?

If you are interested in other cities’ transit systems, where would you look for transit data? Recall, this lesson used data from both the MBTA as well MassGIS, a statewide agency. Local, county, state, and national agencies and departments might be sharing the data you ultimately are seeking.

7. Further Reading

Using Coordinate Systems and Projections in R and Leaflet
More on Coordinate Systems and Projections in R
Tutorial on Adding Buffers and Leaflet
Tutorial on Making Maps in R

You’re done! Help us improve this site with you valuable feedback, by taking our 5 minute survey.