Skip to content

Instantly share code, notes, and snippets.

@mjbommar
Created April 15, 2012 12:51
# Clear and load libraries
rm(list=ls())
library(ggplot2)
library(stats)
# Read data
data <- read.csv("bills-all.csv", comment.char='')
# Plot and save.
ggplot(data) +
geom_bar(aes(x=Reading.Level, fill=Stage), alpha=0.75, binwidth=1) +
scale_x_continuous("Reading Level") +
scale_y_continuous("Count") +
opts(title="Reading Level and Bill Stage")
ggsave(file="reading_level_bill_stage_20120415.jpg", width=8, height=6)
# Run KS test.
introduced <- (data$Reading.Level[which(data$Stage %in% c("Introduced-in-House", "Introduced-in-Senate"))])
engrossed <- (data$Reading.Level[which(data$Stage %in% c("Engrossed-in-House", "Engrossed-in-Senate"))])
print(ks.test(introduced, engrossed, alternative="less"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment