Created
April 15, 2012 12:51
Bill Complexity Example 1, http://www.michaelbommarito.com/blog/2012/04/15/visualization-of-reading-level-frequency-by-bill-stage/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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