Background

Sometimes crime increases around sports venues on game days1. It happens in Cleveland, too2.

Methods

Results

Charges per game day

Contingency table of total charges on game days and non-game days, by venue.
Venue GameDay charges
FE 0 43
FE 1 70
GP 0 43
GP 1 85
Frequency of crime by three categories on game days and non-game days in Cleveland,Ohio.

Frequency of crime by three categories on game days and non-game days in Cleveland,Ohio.

Code

knitr::opts_chunk$set(message = FALSE, warning=FALSE, 
                      echo=FALSE, eval=TRUE, fig.path='Figs/') 
if (!require("pacman")) install.packages("pacman")
pacman::p_load(plyr, dplyr, xtable, ggplot2, knitr)

clev.d <- read.csv("C:/Users/devan.mcgranahan/GoogleDrive/Teaching/Classes/Intro to R/course materials/class session materials/data/AllClevelandCrimeData.csv")
# Calculate total charges per venue, game day/non-game day
    charge.tot <- ddply(clev.d, .(Venue, GameDay),
                    summarize, charges=length(GameDay))
charge.tot
kable(charge.tot, caption='Contingency table of total charges on game days and non-game days, by venue.')
 gd.charges <- subset(clev.d, ChargeType %in% c("VIOLENT", 
                                                 "RESISTING ARREST",
                                                 "PROPERTY"))
  

  # Stop the shouting!
  gd.charges$ChargeType <- tolower(gd.charges$ChargeType)
  ggplot(gd.charges) + theme_bw(14) +
    geom_bar(aes(x=reorder(ChargeType, 
                           ChargeType,
                           function(x)-length(x)), 
                 fill=factor(GameDay)), 
             stat="count", 
             position = "dodge") +
    labs(x="Charge type", 
         y="Frequency of incidents") + 
    theme(axis.text.x=element_text(angle=45, hjust=1),
          legend.position=c(0.75,0.8), 
          legend.key.width=unit(0.25, "in")) +
    scale_fill_brewer(palette="Set1", 
                      name="Game day?", 
                      labels=c("No","Yes"))
sessionInfo();

Session info

## R version 3.4.3 (2017-11-30)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 7 x64 (build 7601) Service Pack 1
## 
## Matrix products: default
## 
## locale:
## [1] LC_COLLATE=English_United States.1252 
## [2] LC_CTYPE=English_United States.1252   
## [3] LC_MONETARY=English_United States.1252
## [4] LC_NUMERIC=C                          
## [5] LC_TIME=English_United States.1252    
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] bindrcpp_0.2  knitr_1.18    ggplot2_2.2.1 xtable_1.8-2  dplyr_0.7.4  
## [6] plyr_1.8.4    pacman_0.4.6 
## 
## loaded via a namespace (and not attached):
##  [1] Rcpp_0.12.15       bindr_0.1          magrittr_1.5      
##  [4] munsell_0.4.3      colorspace_1.3-2   R6_2.2.2          
##  [7] rlang_0.1.6        highr_0.6          stringr_1.2.0     
## [10] tools_3.4.3        grid_3.4.3         gtable_0.2.0      
## [13] htmltools_0.3.6    lazyeval_0.2.1     yaml_2.1.16       
## [16] rprojroot_1.3-2    digest_0.6.14      assertthat_0.2.0  
## [19] tibble_1.4.1       RColorBrewer_1.1-2 glue_1.2.0        
## [22] evaluate_0.10.1    rmarkdown_1.8      labeling_0.3      
## [25] stringi_1.1.6      compiler_3.4.3     pillar_1.1.0      
## [28] scales_0.5.0       backports_1.1.2    jsonlite_1.5      
## [31] pkgconfig_2.0.1

1. Kurland, J., Johnson, S.D. and Tilley, N. 2014. Offenses around stadiums: A natural experiment on crime attraction and generation. Journal of Research in Crime and Delinquency 51:5–28.

2. Mayntz, D. and Toft, S. 2001. Nutrient composition of the prey’s diet affects growth and survivorship of a generalist predator. Oecologia 127:207–213.