March 30, 2020

Statewide school closures as a gif

We don’t know what the total impact of the Covid-19 pandemic will look like. What we do know is that our economy, communities, families, and lives are disrupted in ways they haven’t been for a century — including schools.

As I write this blog on March 30, school systems in 47 states have closed their doors to students, with the remaining three states of Iowa, Maine, and Nebraska opting to allow closure decisions to be made at the district level. Education Week produced a helpful map and spreadsheet of closure-related information, indicating when these decisions were made, how long schools are expected to be closed (for now), and information about the total number of schools and students in each state.

The past three weeks have been a blur of news about school closures, but this data from EdWeek really helped to clarify the timeline of events for me. I thought displaying this information visually might help people to get a better sense of when and where statewide closure decisions happened over the past few weeks, so I decided to make my first gif using R.

How I made it

The gganimate package was pretty easy to work with, and other tools like lubridate and urbnmapr helped make data wrangling and mapping a breeze. One of my biggest Excel peevs reared its ugly head: dates that get converted to an inscrutable string of numbers.

It’s easy to solve with a little math, but it still annoys me. Thankfully, Sam Firke’s janitor package solves this problem with one function.

Once the date formatting issue was resolved, it was just a matter of creating a closure “status” variable for each day from March 15 to March 25, reshaping the data to make it “long,” and cleaning up the special cases of the three states without a statewide closure decision.

When it came time to render the gif on my four-year-old MacBook Adorable, it took less than a minute. Not great, but not too shabby.

As always, my code for this project is on GitHub.

Closing thoughts

I’m satisfied with my first gif and it really was pretty easy with gganimate. My hope is that this gif helps a few people understand a small slice of what’s happening to our students, educators, and schools right now.

Stay safe, stay home, and stay healthy. ❤️

November 4, 2019

Making an editable map for PowerPoint with R

Recently, I needed to make a map that would color-code states and overlay some points to represent data for specific metro areas. My initial reaction to graphic creation is to always start with R and use ggplot2, but the final product also needed to be editable as a PowerPoint graphic.

This was the perfect opportunity to try a few R packages that were new to me: the urbnmapr package from the Urban Institute for map-making and the officer and rvg packages to export data from R into Microsoft Office document formats (including .pptx).

Using a great tutorial on how to use urbnmapr, I was able to produce the map I wanted pretty quickly. All it took was a simple left_join() to merge my state data with the urbnmapr data, then all I had to do was use geom_polygon and geom_point to map my two layers of data.

I recreated a version of the map I made using two tables of data:

  • A list of states, coded as states I’ve called home, visited, or never been
  • A list of coordinates indicating where I’ve done postsecondary work

It took me about 15 minutes to pull this together - most of it was spent actually creating the data:

Most of the time, I’m exporting the plot as a static .png file, but thanks to the officer and rvg packages, I was able to export my ggplot object to a slide in a .pptx deck:


read_pptx() %>%
  add_slide(layout = "Title and Content", master = "Office Theme") %>%
# this is where you call your ggplot object (here it's `place_ps_map`)
  ph_with_vg(code = print(place_ps_map), type = "body") %>% 
# this is where you provide the filename/location for your new ppt slide
  print(target = "place_ps_map.pptx")

That’s it! From that point, I was able to open the PowerPoint deck and play around with every part of my map. I “ungrouped” all of the elements, then re-grouped the legend and map elements as separate groups to make re-positioning really easy.

If you want to check out the code and data I used, it’s available on Github.

March 18, 2019

Selective high schools and diversity

New York City’s selective high schools have a diversity problem:

Though black and Hispanic students make up nearly 70 percent of New York City’s public school system as a whole, just over 10 percent of students admitted into the city’s eight specialized high schools were black or Hispanic, according to statistics released Monday by the city. That percentage is flat compared to last year.

It’s also a problem in Louisville.

DuPont Manual is commonly viewed as the most desirable public high school Jefferson County. It’s a selective admissions school that accepts applications from students from all over the county and offers free transportation to those that are selected for admission.

Yet in a district where 36% of students are African American, only 13% of Manual students are African American (the smallest percentage of any JCPS high school) and admission tends to favor students from the most affluent areas of Louisville.

Using data from the JCPS Data Book and the US Census Bureau, we can see how a student’s home zip code correlates to the chance they will attend duPont Manual. Across all of JCPS, about 3.5% of high school students are enrolled at Manual, but that rate varies significantly by students’ resident zip code.

In Jefferson County’s seven most affluent zip codes, JCPS students are anywhere from 2 to 4.5 times more likely to enroll at Manual than the JCPS district average.


Those familiar with Louisville won’t be surprised with the income distribution across zip codes, shown in the map below.


But it’s revealing that the map above so closely mirrors the map below, which reflects the odds that a JCPS high school student in a given zip code is attending Manual. In every zip code west of duPont Manual’s campus, students are enrolling at Manual at less than half the district rate. There are three zip codes in West Louisville with more than five thousand resident JCPS high school students, but only 46 students attend Manual - less than 1% of the resident students in these communities.


Unlike NYC, we don’t have publicly available data to further illustrate how many students have applied to Manual, where they live in Jefferson County, how many were qualified but not admitted, etc. But the opaque admissions process at Manual does appear to favor families from communities with more financial resources.

I don’t begrudge any family that currently sends or has sent students to Manual — it’s a great school and those parents have every right to seek out the best situation for their children. But a student’s educational opportunities shouldn’t be limited by the value of a home their parent(s) can afford. Louisville’s most selective public school, like NYC’s selective high schools, aren’t granting enough opportunities to the students who would stand to benefit the most from admission.

It’s why Kentucky should keep pushing to expand school choice. Low-income and African American families deserve the same opportunity to choose a great school for their child as a family in Anchorage or Prospect.

March 8, 2019

Grading my PLL proposal - first four cities

As of today, Premier Lacrosse League (PLL) has named 4 of the 12 cities that will host games during their inaugural season. The PLL started with a list of 30 cities and in January, I posted what I thought would be the ideal slate of 12 cities for the new league.

My initial selections started with the idea that the PLL should focus the bulk of their schedule in regions where youth lacrosse has the fastest growth rates. Now that the first four cities have been named, my picks are looking pretty good.


Grading my proposal’s accuracy after 4 cities: B+

I nailed three out of the four: New York, Chicago, and Baltimore. I’ll also give myself a half-point for Boston - while I thought that the PLL should pick one of the group of Boston/Hartford/Providence, my Hartford homerism weighed too heavily on my initial pick.

Here’s what I’d like to see out of the next 8 PLL city announcements:

  • 2 more “Midwest” region cities
  • 3 “South” region cities
  • 3 “West” region cities

I really think that the PLL should avoid picking any more “Northeast” region cities. If they’re serious about increasing the exposure of the sport, they’ll need skate to where the puck is going, not to where it’s been.

March 6, 2019

Teacher pay, community income, and sickouts


Do teachers in Kentucky earn more or less than the median household in the communities they serve?1

The most recent data from the American Community Survey show that the Median Household Income (MHI) in Kentucky is $46,535. In the 2018-19 school year, data from the Kentucky Department of Education show that the average certified salary for Kentucky teachers was $57,819 - a difference of $11,284. However, household income and teacher salaries vary across communities in Kentucky. In most of the state, teachers earn more in salary than the median household, but there are communities where those dollar amounts are similar, and in a handful of the state’s most affluent communities, teachers earn less than the median household’s income.

In the state’s largest district (Jefferson County), certified teachers in the 2018-19 school year earned $69,674 while the median household earned about $52,237 - a difference of $17,437. In neighboring Oldham County (the most affluent in the state) teachers earned an average of $56,118 in a community where the MHI is $92,273 - a difference of $36,155.

Salary Category Districts FTE % of Total FTE
Less than 90% of MHI 5 3,420 6.8%
Similar to MHI (+/- 10%) 33 9,021 17.8%
Slightly more than MHI (10-50%) 85 29,352 58.0%
Significantly more than MHI (50-200%) 36 6,823 13.5%
More than double MHI 14 1,982 3.9%

There are only 4 counties in Kentucky where the average teacher’s salary is less than 90% the county’s MHI. These are also happen to be the counties with the highest MHI: Oldham, Boone, Spencer, and Scott. On the other end of the spectrum, there are 50 districts where teachers are earning at least 50% more than the median household in their counties, representing 17.4% of certified teacher FTEs. In the majority of districts, teachers representing 58% of certified FTEs earned 10-50% more than the MHI in their counties.


1 in 4 of Kentucky’s certified teachers work in a district where the average salary is similar to or less than the MHI of their employer’s county, which means 75% of certified teachers in Kentucky work in a district where the average salary is at least 10% more than the median household in the community they serve.

Why does this matter?

Kentucky has seen several days of teacher “sickouts” during this school year. These quasi-strikes were sparked in protest of changes to pension laws, proposed changes to a pension governing board, tax credit scholarship legislation, and a bill to change the process for hiring principals in Jefferson County.

Setting aside the merits of these policies, it’s important to consider the impact of “sickouts” on students and families. These disruptions to learning happen with little notice for parents/guardians to arrange childcare and for three quarters of the state, it’s done by public employees who out-earn the median household in the community they serve.

The raison d’etre for these school closures is often only tangentially connected to improving outcomes for kids. When it’s led by professionals earning more - sometimes significantly more - than the families they serve, quasi-strikes of teachers may actually lead to reduced support for their policy goals.

I’m a big fan of teachers - I was a public school teacher and my sister has made it her career. But I would urge Kentucky’s teachers to consider the impact of school shutdowns on the kids and families they serve before further utilizing that tactic. The vast majority of homes in the communities they serve earn less than the average teacher and may not have the means to arrange childcare on short notice. Additionally, disrupting the learning process may be even more harmful for economically disadvantaged students.

In the end, students and families bear the costs of “sickouts” in Kentucky and the benefits to them are not very clear. I’m not sure how many more school closures families will tolerate, but there is certainly a limit - I just hope that teachers don’t push past it.

  1. All code and data used to answer this question are available on my GitHub page. [return]