library(ggplot2)
library(ggthemes)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(readxl)
ccrb <- read_excel("ccrb.xlsx")
summary(ccrb)
## DateStamp UniqueComplaintId Close Year Received Year
## Min. :2016-11-29 Min. : 1 Min. :2006 Min. :1999
## 1st Qu.:2016-11-29 1st Qu.:17356 1st Qu.:2008 1st Qu.:2007
## Median :2016-11-29 Median :34794 Median :2010 Median :2009
## Mean :2016-11-29 Mean :34778 Mean :2010 Mean :2010
## 3rd Qu.:2016-11-29 3rd Qu.:52204 3rd Qu.:2013 3rd Qu.:2012
## Max. :2016-11-29 Max. :69492 Max. :2016 Max. :2016
## Borough of Occurrence Is Full Investigation Complaint Has Video Evidence
## Length:204397 Mode :logical Mode :logical
## Class :character FALSE:107084 FALSE:195530
## Mode :character TRUE :97313 TRUE :8867
##
##
##
## Complaint Filed Mode Complaint Filed Place
## Length:204397 Length:204397
## Class :character Class :character
## Mode :character Mode :character
##
##
##
## Complaint Contains Stop & Frisk Allegations Incident Location
## Mode :logical Length:204397
## FALSE:119856 Class :character
## TRUE :84541 Mode :character
##
##
##
## Incident Year Encounter Outcome Reason For Initial Contact
## Min. :1999 Length:204397 Length:204397
## 1st Qu.:2007 Class :character Class :character
## Median :2009 Mode :character Mode :character
## Mean :2010
## 3rd Qu.:2012
## Max. :2016
## Allegation FADO Type Allegation Description
## Length:204397 Length:204397
## Class :character Class :character
## Mode :character Mode :character
##
##
##
Data Visualization 1
ggplot(ccrb, aes(x=ccrb$`Received Year`, fill= ccrb$`Borough of Occurrence`)) + geom_histogram(stat = "count") + labs (title = "Borough of Occurence by Year", x="Received Year", y="Number of Complaints") + theme (legend.position = "bottom") + scale_fill_discrete(name = "Borough")
## Warning: Ignoring unknown parameters: binwidth, bins, pad
Data Visualization 2
ggplot(ccrb, aes(x=ccrb$`Received Year`, fill= ccrb$`Allegation FADO Type`)) + geom_histogram(stat = "count") + labs (title = "Allegation type by Year", x="Received Year", y="Number of Complaints") + theme (legend.position = "bottom") + scale_fill_discrete(name = "Allegation Type")
## Warning: Ignoring unknown parameters: binwidth, bins, pad
Data Visualization 3
ggplot(ccrb, aes(x=ccrb$`Received Year`, fill= ccrb$`Complaint Filed Mode`)) + geom_histogram(stat = "count") + labs (title = "Complaint Filed Mode by Year", x="Received Year", y="Number of Complaints") + theme (legend.position = "bottom") + scale_fill_discrete(name = "Complaint Filed Mode")
## Warning: Ignoring unknown parameters: binwidth, bins, pad
Data Visualization 4
ggplot(ccrb, aes(x=ccrb$`Received Year`, fill= ccrb$`Complaint Filed Place`)) + geom_histogram(stat = "count") + labs (title = "Complaint Filed Place by Year", x="Received Year", y="Number of Complaints") + theme (legend.position = "bottom") + scale_fill_discrete(name = "Complaint Filed Place")
## Warning: Ignoring unknown parameters: binwidth, bins, pad
## Warning: position_stack requires non-overlapping x intervals
Data Visualization 5
ggplot(ccrb, aes(x=ccrb$`Allegation FADO Type`, fill= ccrb$`Allegation FADO Type`)) + geom_bar(stat = "count") + labs (title = "Number of Complains by Allegation Type", x="Allegation Type", y="Number") + theme (legend.position = "top") + scale_fill_discrete(name = "Allegation Type")
Data Visualization 6
ggplot(ccrb, aes(x=ccrb$`Borough of Occurrence`, fill= ccrb$`Borough of Occurrence`)) + geom_bar(stat = "count") + labs (title = "Number of Complains by Borough of Occurrence", x="Borough of Occurrence", y="Number") + theme (legend.position = "top") + scale_fill_discrete(name = "Borough of Occurrence")
Data Visualization 7
ggplot(ccrb, aes(x=ccrb$`Encounter Outcome`, fill= ccrb$`Encounter Outcome`)) + geom_bar(stat = "count") + labs (title = "Encounter Outcome By Number", x="Encounter Outcome", y="Number") + theme (legend.position = "top") + scale_fill_discrete(name = "Encounter Outcome")
Data Visualization 8
ggplot(ccrb, aes(x=ccrb$`Complaint Has Video Evidence`, fill= ccrb$`Complaint Has Video Evidence`)) + geom_bar(stat = "count") + labs (title = "Complaint Has Video Evidence By Number", x="Complaint Has Video Evidence", y="Number") + theme (legend.position = "top") + scale_fill_discrete(name = "Complaint Has Video Evidence")
Data Visualization 9
ggplot(ccrb, aes(x=ccrb$`Incident Location`, fill= ccrb$`Incident Location`)) + geom_bar(stat = "count") + labs (title = "Incident Location By Number", x="Encounter Outcome", y="Number") + theme (legend.position = "bottom") + scale_fill_discrete(name = "Incident Location")
Data Visualization 10
ggplot(ccrb, aes(x=ccrb$`Is Full Investigation`, fill= ccrb$`Is Full Investigation`)) + geom_bar(stat = "count") + labs (title = "Full Investigation By Number", x="Encounter Outcome", y="Number") + theme (legend.position = "bottom") + scale_fill_discrete(name = "Full Investigation")