Author: Brad Cable
library(ggplot2)
repData <- read.csv("rep.txt", header=TRUE)
repData$pop <- repData$pop / 1000000
repData$totalReps <- repData$house + repData$senate
repData$ratio <- repData$totalReps / repData$pop
g <- ggplot(repData, aes(y=pop, x=year))
g <- g + geom_line() + xlab("Year") + ylab("Population (millions)")
g + ggtitle("Population by Year") + theme_bw()
g <- ggplot(repData, aes(y=totalReps, x=year))
g <- g + geom_line() + xlab("Year") + ylab("Total Representatives")
g + ggtitle("Total Representatives by Year") + theme_bw()
g <- ggplot(repData, aes(y=ratio, x=year))
g <- g + geom_line() + xlab("Year") + ylab("Representation Ratio")
g + ggtitle("Representation Ratio by Year") + theme_bw()