OFM School District Data

Harold Nelson

11/3/2021

Setup

library(tidyverse)
library(sf)
library(raster)
library(tmap)

Get Districts

sd = st_read("saep_unsd10.shp")
## Reading layer `saep_unsd10' from data source 
##   `/Users/haroldnelson/Dropbox/WA Geodata/saep_unsd10.shp' using driver `ESRI Shapefile'
## Simple feature collection with 295 features and 144 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: 579552.7 ymin: 81835.08 xmax: 2551107 ymax: 1355593
## Projected CRS: NAD83(HARN) / Washington South (ftUS)
tm_shape(sd) + tm_borders()

Look at Populations

sd %>% ggplot(aes(x=POP2020)) + 
  geom_histogram() +
  scale_x_log10() +
  ggtitle("2020 Populations of WA School Districts ")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

summary(sd$POP2020)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##      53    1578    6924   25953   23528  761932

Get Small Districts

See where they are.

small_sd = sd %>% 
  filter(POP2020 < 1000)
tm_shape(sd) + 
  tm_polygons() +
tm_shape(small_sd) +
  tm_fill(col = "red")

Population Density

sd = sd %>% 
  mutate (density = POP2020/ALANDMI)

summary(sd$density)
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
##    0.265    8.504   48.817  453.378  253.631 8918.373

Density Geography

tm_shape(sd) +
  tm_polygons(col = "density",style = "quantile") +
  tm_layout(main.title = "People/Sq. Mile \n Washington School Districts")