Created
September 16, 2013 10:05
-
-
Save jamestrimble/6578789 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# eurostat_r.r should be in the working directory. | |
# See http://johanneskutsam.blogspot.co.uk/2012/10/eurostat-in-r-in-git.html | |
library(ggplot2) | |
library(scales) | |
source('eurostat_r.r') | |
eu_codes <- c('BE', 'BG', 'CZ', 'DK', 'DE', 'EE', 'IE', 'EL', 'ES', | |
'FR', 'HR', 'IT', 'CY', 'LV', 'LT', 'LU', 'HU', 'MT', | |
'NL', 'AT', 'PL', 'PT', 'RO', 'SI', 'SK', 'FI', 'SE', | |
'UK') | |
u <- read.eurostat('une_rt_q') | |
# Youth unemployment since 2000 | |
youth_unemployment <- subset(u, time >= as.yearqtr('2000 Q1') & | |
S_ADJ=='SA' & | |
AGE=='Y_LT25' & | |
GEO %in% eu_codes) | |
youth_unemployment$time <- as.Date(youth_unemployment$time) | |
# Shorten name for Germany | |
levels(youth_unemployment$GEO_desc)[levels(youth_unemployment$GEO_desc)== | |
'Germany (until 1990 former territory of the FRG)'] <- | |
'Germany' | |
png('youth_unemployment.png', width=900, height=600) | |
ggplot(youth_unemployment, aes(x=time, y=value, colour=SEX_desc, group=SEX_desc)) + | |
facet_wrap(~ GEO_desc) + | |
geom_line() + | |
theme_bw() + | |
xlab('Year') + | |
ylab('Youth unemployment rate') + | |
scale_x_date(labels = date_format("%y")) + | |
theme(legend.title=element_blank()) | |
dev.off() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment