Last active
August 29, 2015 14:24
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
library(ggplot2) | |
library(dplyr) | |
#data from http://www.doccs.ny.gov/Research/annotate.asp | |
#escape duration is the max duration for the coding | |
#e.g. <6 hours is coded as 6 hours, 1-2 days coded as 48h | |
df=structure(list(year = c(2002L, 2002L, 2002L, 2002L, 2003L, 2003L, | |
2003L, 2003L, 2003L, 2003L, 2004L, 2004L, | |
2005L, 2005L, 2006L, 2006L, 2006L, 2006L, | |
2007L, 2007L, 2009L, 2010L, 2010L, 2010L, | |
2011L, 2011L, 2011L, 2011L, 2012L, 2013L), | |
duration = c(6, 6,6, 12, 6, 6, 6, 48, 48, 48, 6, | |
6, 6, 24, 6, 6, 12, 72, 6, 6,24, 24, | |
24, 24, 1, 0.1, 0.1, 1.5, 0.1, 24)), | |
class = "data.frame", row.names = c(NA, -30L), | |
.Names = c("year", "duration")) | |
p=ggplot(df,aes(x=duration, | |
fill=as.factor(round(duration/24,0)), | |
color=as.factor(round(duration/24,0)))) | |
p=p+geom_dotplot(binwidth=1) | |
p=p+labs(x="Escape duration in hours",y="Count", | |
title="New York State Department of Corrections | |
Inmate Escape Durations 2002-2013") | |
p=p+coord_fixed(ratio=1)+ylim(0,13) + | |
theme_bw() + | |
theme(legend.position="none") | |
p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment