Skip to content

Instantly share code, notes, and snippets.

@cigrainger
Created August 22, 2013 23:46
Show Gist options
  • Save cigrainger/6314084 to your computer and use it in GitHub Desktop.
Save cigrainger/6314084 to your computer and use it in GitHub Desktop.
Dissertation
prices <- read.csv("~/Documents/CEX0711/prices.csv")
colnames(prices) <- sub("[.]", " ", colnames(prices))
prices <- melt(prices)
prices$Date <- as.yearmon(prices$Date,format="%b-%Y")
colnames(prices) <- c('time','statename','price')
prices$year <- format(prices$time,format="%Y")
statetax <- read.csv("~/Documents/CEX0711/statetax.csv")
colnames(statetax)[1] <- "statename"
colnames(statetax) <- sub("[X]", "", colnames(statetax))
statetax <- melt(statetax)
colnames(statetax) <- c('statename','year','tax')
pricetax <- merge(statetax,prices)
pricetax$federaltax <- rep(18.4,length(pricetax$tax))
pricetax$totaltax <- (pricetax$tax + pricetax$federaltax)/100
pricetax$nprc <- pricetax$price + pricetax$totaltax
pricemerge <- data.frame("statename"=pricetax$statename,"time"=pricetax$time,"nprc"=pricetax$nprc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment