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:

library(officer)
library(rvg)

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.

zip-plot

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

mhi-map

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.

manual-map

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.

pll-cities-v2

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

salary-mhi-map

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.

ratio-map

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]

January 19, 2019

Untapped Potential

An incredible special report from the Boston Globe:

Over the past year, the Globe has tracked down 93 of the 113 valedictorians who appeared in the paper’s first three “Faces of Excellence” features from 2005 to 2007. We wanted to know, more than a decade later, how the stories of Boston’s best and brightest were turning out.

The entire collection of articles, graphics, and data paints a challenging and inspiring picture of the obstacles facing the “best and brightest” students in Boston’s public schools. Many of the students faced financial and/or social struggles when they first entered college, but some also found themselves academically unprepared for college work.

Some of the valedictorians - notably, the ones from selective “exam schools” - fared better than other public school graduates. That there could be such a wide variation in the quality of academic preparation among schools’ highest-performing students is extremely disappointing, but not surprising.

Much work remains to be done to help students navigate the transition from high school to college, both financially and socially, but K-12 leaders and policymakers should at a bare minimum ensure that high school coursework can prepare students academically for their next step. That may mean entering the workforce or military, attending a community college, or enrolling in a highly selective university, but no student should have their potential limited by policymakers’ lowered expectations and/or unchallenging curricular options.