US High School Graduation Rates, using googleVis

Here is an analysis and some graphics using googleVis on high school graduation rates in the United States.

A report from the US Deparment of Education on increasing high school graduation rates was published earlier this year (Jan 2013) and some summary graphics were shown on the Department's blog. However, the above blog only shows one static map. Here is my attempt to do it better using R and googleVis.

All relevant files are on my GitHub site

First, get the data on Averaged Freshman Graduation Rate (AFGR).

Second, load the data and rename variables appropriately.

# read data
afgr <- read.delim("nces_afgr.txt", as.is = TRUE)
# rename columns
colnames(afgr)[-1] <- paste0("AFGR_", sprintf("%.2d", seq(2, 9)), "_", sprintf("%.2d", 
    seq(3, 10)))

# subset of data from 09-10 and 05-06
afgr <- afgr[, c("State", "AFGR_05_06", "AFGR_09_10")]
# percent change from 05-06 (consistent with Department's blog)
afgr$percent_change <- afgr$AFGR_09_10 - afgr$AFGR_05_06

Third, make some cool plots using googleVis.

An interactive version of the 2009-10 graduation rates.

# load libraries
library(knitr)
suppressPackageStartupMessages(library(googleVis))

# plot 2009-10
chart_1 <- gvisGeoChart(data = afgr, locationvar = "State", colorvar = "AFGR_09_10", 
    options = list(region = "US", displayMode = "regions", resolution = "provinces", 
        width = 600, height = 400), chartid = "0910")

print(chart_1, "chart")

Here are the percent changes from 2005-06 to 2009-10. You can see that except for a handful of states, the graduation rates have increased for most of the states.

# plot change from 2005-06
chart_2 <- gvisGeoChart(data = afgr, locationvar = "State", colorvar = "percent_change", 
    options = list(region = "US", displayMode = "regions", resolution = "provinces", 
        colorAxis = "{values:[-10, 0, 10],\n                                       colors:['red', 'grey', 'blue']}", 
        width = 600, height = 400), chartid = "change")
print(chart_2, "chart")

Here is the data in a tabluar format.

chart_3 <- gvisTable(data = afgr)

print(chart_3, "chart")

Here is the link to the googleVis visualizations - http://rpubs.com/RationShop/afgr