Skip to content

Instantly share code, notes, and snippets.

@hadley
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hadley/9485893 to your computer and use it in GitHub Desktop.
Save hadley/9485893 to your computer and use it in GitHub Desktop.
library("Quandl")
library("ggplot2")
library("reshape2")
hist_rev <- Quandl("TPC/HIST_RECEIPT",
start_date = "1945-12-31",
end_date = "2013-12-31")
# melt into tidy (http://vita.had.co.nz/papers/tidy-data.html) form
hist_revm <- melt(hist_rev, id = "Fiscal Year")
names(hist_revm) <- c("year", "source", "pct_gdp")
# select categories of interest
income_tax <- subset(hist_revm,
source %in% c("Individual Income Taxes", "Corporation Income Taxes"))
qplot(year, pct_gdp, data = income_tax, colour = source) +
geom_line() +
geom_smooth(method = "lm")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment