English: A plot of the USS ("
Universities Superannuation Scheme")
pension fund deficit across time.
https://en.wikipedia.org/wiki/Universities_Superannuation_Scheme
R code to create graph
library(ggplot2)
library(cowplot)
- ============================
- = data read and formatting =
- ============================
fp = "~/Desktop/USS_pension_assets_and_liabilities.xlsx"
df = gdata::read.xls(xls = fp, stringsAsFactors=FALSE, sheet="transposed")
df$Year = as.Date(paste0(df$Year, "-03-01"))
df$percent_funded = df$percent_funded *100
as.numeric(df$Year)
- ==================
- = Construct Plot =
- ==================
p = qplot(Year, percent_funded, data= df)
p = p + geom_smooth(method = "auto", se = TRUE)
p = p + labs(title= "USS Balance sheet", x = "Year", y = "Percent of scheme funded")
p = p + geom_hline(yintercept = 100, color = "red")+ theme(text = element_text(size = 13))
p = p + scale_x_date(date_breaks = "1 year", date_labels = "%Y", minor_breaks = NULL)
p = p + draw_label("2011 Changes", x = 15034, y = 102, hjust = 0, vjust = 0)
p = p + draw_label("2015 Changes", x = 16495, y = 90, hjust = 0, vjust = 0)
p