1 Introduction

This note will detail the process I used to create my map of homelessness in Oregon public school districts. This map shows, for each public school district in Oregon, the percent of students reported to be navigating homelessness during the 2018-2019 school year.

1.1 Software packages and options

We will use the R programming language to process the data and create the maps. Our package list:

All of these packages are straightforward to install with the exception of extrafont. After installing extrafont for the first time, you must run the command extrafont::font_import() once to load all of your system fonts into the extrafont database. That process can take a while, but you’ll never need to run that command again. Afterward, all of your system fonts will be available in R just by calling library(extrafont) as above.

2 The data: why, what, and how

The final map colors each school district’s area according to the percentage of its students who are reported to be experiencing homelessness. The required data processing mostly involves matching the homelessness statistics published by ODE to the district geographies published by the NCES.

Unfortunately, ODE’s data only identifies districts by name, and these names don’t always match the district names in NCES’s data. One of the files we’ll need to download is a little key I made to match these two sets of names.

We’ll also be adding a handful of city markers to the map for orientation. I used Google Maps to get their rough coordinates and saved them in a separate file.

The code below fetches all of this data from the web and saves it in R’s current working directory so that it can be loaded below.

This downloads about 185 MB worth of data. After extracting the archives, the final size of the files is around 292 MB.

2.1 District shapes

Here we load the NCES district data.

## Reading layer `schooldistrict_sy1819_tl19' from data source `D:\Data\NCES\EDGE_SCHOOLDISTRICT_TL19_SY1819' using driver `ESRI Shapefile'
## Simple feature collection with 13315 features and 18 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: -179.1686 ymin: -14.5487 xmax: 179.7487 ymax: 71.38961
## CRS:            4269
## Rows: 197
## Columns: 19
## $ STATEFP    <chr> "41", "41", "41", "41", "41", "41", "41", "41", "41", "4...
## $ ELSDLEA    <chr> NA, "03600", "04170", "04290", "04380", "05020", "05310"...
## $ SCSDLEA    <chr> "03630", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ UNSDLEA    <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "00003", "00014"...
## $ GEOID      <chr> "4103630", "4103600", "4104170", "4104290", "4104380", "...
## $ NAME       <chr> "Harney County Union High School District 1J", "Harney C...
## $ LSAD       <chr> "00", "00", "00", "00", "00", "00", "00", "00", "00", "0...
## $ LOGRADE    <chr> "09", "KG", "KG", "KG", "KG", "KG", "KG", "KG", "KG", "K...
## $ HIGRADE    <chr> "12", "08", "08", "08", "08", "08", "08", "12", "08", "0...
## $ MTFCC      <chr> "G5410", "G5400", "G5400", "G5400", "G5400", "G5400", "G...
## $ SDTYP      <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ FUNCSTAT   <chr> "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "...
## $ ALAND      <dbl> 22858014359, 5278048439, 1630525834, 571817653, 97048913...
## $ AWATER     <dbl> 238933116, 210793901, 825382, 5759643, 8441028, 3548745,...
## $ INTPTLAT   <chr> "+42.9562139", "+43.2518663", "+42.9659106", "+43.299273...
## $ INTPTLON   <chr> "-118.9338052", "-118.8745532", "-118.6061945", "-119.28...
## $ GEO_YEAR   <chr> "2019", "2019", "2019", "2019", "2019", "2019", "2019", ...
## $ SCHOOLYEAR <chr> "2018-2019", "2018-2019", "2018-2019", "2018-2019", "201...
## $ geometry   <MULTIPOLYGON [°]> MULTIPOLYGON (((-118.812 44..., MULTIPOLYGO...

2.2 Homelessness statistics

Next we load the homelessness data. Two small changes are made to the district names:1

  1. We replace “Co.” with “County”.
  2. We change “Bend-LaPine SD 1” to “Bend-LaPine Administrative SD 1”.

Note that the percentages file does not include all school districts. Missing districts did not indicate that any of their students were homeless. We will fill in these missing zeros below.

2.3 Associating the statistics with the district shapes

Finally we’ll join the percentages to the district shapes using our ODE-NCES district name key.

## Rows: 197
## Columns: 21
## $ STATEFP    <chr> "41", "41", "41", "41", "41", "41", "41", "41", "41", "4...
## $ ELSDLEA    <chr> NA, "03600", "04170", "04290", "04380", "05020", "05310"...
## $ SCSDLEA    <chr> "03630", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ UNSDLEA    <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "00003", "00014"...
## $ GEOID      <chr> "4103630", "4103600", "4104170", "4104290", "4104380", "...
## $ NAME       <chr> "Harney County Union High School District 1J", "Harney C...
## $ LSAD       <chr> "00", "00", "00", "00", "00", "00", "00", "00", "00", "0...
## $ LOGRADE    <chr> "09", "KG", "KG", "KG", "KG", "KG", "KG", "KG", "KG", "K...
## $ HIGRADE    <chr> "12", "08", "08", "08", "08", "08", "08", "12", "08", "0...
## $ MTFCC      <chr> "G5410", "G5400", "G5400", "G5400", "G5400", "G5400", "G...
## $ SDTYP      <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ FUNCSTAT   <chr> "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "...
## $ ALAND      <dbl> 22858014359, 5278048439, 1630525834, 571817653, 97048913...
## $ AWATER     <dbl> 238933116, 210793901, 825382, 5759643, 8441028, 3548745,...
## $ INTPTLAT   <chr> "+42.9562139", "+43.2518663", "+42.9659106", "+43.299273...
## $ INTPTLON   <chr> "-118.9338052", "-118.8745532", "-118.6061945", "-119.28...
## $ GEO_YEAR   <chr> "2019", "2019", "2019", "2019", "2019", "2019", "2019", ...
## $ SCHOOLYEAR <chr> "2018-2019", "2018-2019", "2018-2019", "2018-2019", "201...
## $ ODE        <chr> "Harney County Union High SD 1J", "Harney County SD 4", ...
## $ Pct.Enrlmt <dbl> 0.000000000, 0.000000000, 0.000000000, 0.000000000, 0.00...
## $ geometry   <MULTIPOLYGON [°]> MULTIPOLYGON (((-118.812 44..., MULTIPOLYGO...

This concludes the data processing part of the project.

3 Creating the map

Our map will fill each district area with a color according to its reported percentage of students navigating homelessness. We’ll then add a second layer of dots located at certain cities plus text for the city names.

First we load the city coordinates. Since some of the cities are quite close to each other, we’ll adjust their labels up, down, left, or right so that they don’t overlap.

Finally, here’s the map.

We save the map with a call to ggplot2::ggsave(). In the call I use a haphazard combination of size and scaling parameters that resulted in a nice end product.

4 Acknowledgements

I would like to thank Amelia Vargas for her valuable suggestions and criticism. Thanks also to Dona Bolt at ODE for helping me understand more about how this data was collected.


Antonio R. Vargas

3 May 2020


  1. These changes aren’t strictly necessary—we could have just accounted for these name changes in the ODE-NCES district names key. However, the ODE names we ended up listing in the key are more similar to district names ODE uses in their other datasets. I think the current ODE-NCES key will be useful for future projects.