Skip to content

Instantly share code, notes, and snippets.

@rpietro
Created September 1, 2013 14:39
Show Gist options
  • Save rpietro/6404853 to your computer and use it in GitHub Desktop.
Save rpietro/6404853 to your computer and use it in GitHub Desktop.
Analysis of OECD data on education expenditure
#install.packages(c("ggplot2", "gridExtra", "RCurl"))
lapply(c("ggplot2", "gridExtra", "RCurl"), require, character.only = T)
require(ggplot2)
require(gridExtra)
require(RCurl)
# to get the direct link to the csv file from the gist, just click on the <> symbol on the top right corner of the gist
gist <- getURL("https://gist.github.com/rpietro/6404791/raw/9afb4fc45c10592ccd6dcb5cef0fa4c7667b35a7/oecd_ed_expend.csv")
ed <- read.csv(gist)
names(ed)
# listing variables here to make it easier to copy and paste
# "countries" "pre_primary_exp" "intermediate_exp" "tertiary_exp"
# "pre_primary_gdp" "intermediate_gdp" "tertiary_gdp"
tert_exp <- qplot(ed$tertiary_exp, ed$countries)
tert_gdp <- qplot(ed$tertiary_gdp, ed$countries)
int_exp <- qplot(ed$intermediate_exp, ed$countries)
int_gdp <- qplot(ed$intermediate_gdp, ed$countries)
jpeg('combined.jpg')
grid.arrange(tert_exp, tert_gdp, int_exp, int_gdp)
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment