Statewide school closures as a gif

By Alex Spurrier

March 30, 2020

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. ❤️

Posted on:
March 30, 2020
2 minute read, 390 words
See Also: