## Warning: package 'pacman' was built under R version 3.4.3

Background

Sometimes crime increases around sports venues on game days1. Does that happen in Cleveland?

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/micayla.lakey/Desktop/R/Report/AllClevelandCrimeData_1.csv")
# Calculate total charges per venue, game day/non-game day
    charge.tot <- ddply(clev.d, .(Venue, GameDay),
                    summarize, charges=length(GameDay))
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.2 (2017-09-28)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 15063)
## 
## 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.17    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.13       bindr_0.1          magrittr_1.5      
##  [4] munsell_0.4.3      colorspace_1.3-2   R6_2.2.2          
##  [7] rlang_0.1.2        highr_0.6          stringr_1.2.0     
## [10] tools_3.4.2        grid_3.4.2         gtable_0.2.0      
## [13] htmltools_0.3.6    lazyeval_0.2.1     yaml_2.1.14       
## [16] rprojroot_1.2      digest_0.6.12      assertthat_0.2.0  
## [19] tibble_1.3.4       RColorBrewer_1.1-2 glue_1.2.0        
## [22] evaluate_0.10.1    rmarkdown_1.6      labeling_0.3      
## [25] stringi_1.1.5      compiler_3.4.2     scales_0.5.0      
## [28] backports_1.1.1    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.