Skip to content

Instantly share code, notes, and snippets.

@rpietro
Created September 17, 2013 04:35
Show Gist options
  • Save rpietro/6590113 to your computer and use it in GitHub Desktop.
Save rpietro/6590113 to your computer and use it in GitHub Desktop.
education vs employment for OECD data
# setting working directory
setwd("~/Desktop")
# calling packages, need to install packages with install.packages if you haven't installed them before
library(ggplot2)
library(lubridate)
#------------------------------------------------------------------------------
# importing data
edobs <- read.csv("ed_obs.csv", stringsAsFactors=FALSE, header = TRUE)
str(edobs)
names(edobs)
# > names(edobs)
# [1] "json" "country" "year" "empl" "ed"
table(edobs$country)
#emerging markets according with any of the classifications under http://goo.gl/mY1B30 :
# Czech Republic, Greece, Hungary, Mexico, Poland, Slovak Republic, Turkey
#------------------------------------------------------------------------------
qplot(empl, ed, data = edobs)
qplot(empl, ed, data = edobs, color = country) #doesn't work well since there are so many countries, need to create variable for emerging countries (yes/no) according to IMF and then use it as facet
qplot(empl, ed, data = edobs, geom = c("point", "smooth")) # mixes both years, not good
qplot(empl, ed, data = edobs, geom = c("point", "smooth"), facets = . ~ year) # better but need to combine into a single plot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment