save(ccrb, file="ccrb.RData")
## Error in save(ccrb, file = "ccrb.RData"): object 'ccrb' not found
load(file="ccrb.RData")
library(ggplot2)
The graph shows that the amount of incident increased dramatically from 2004 to 2015 and from 2005 to 2006. Most incident in 2006. After 2006, the number of incident decreased every year. It seems like it got controled somehow.
ggplot(ccrb, aes(ccrb$`Incident Year`)) + geom_bar()
As we can see from below graph, the number of accident happened in bus, commercial building, hospital, NYCHA, Park, Police Building, Police vehicel,Public Space/building,Residential building, River or waterway and subway station trend to be stable during those years. But the number of incident happened in school, street/highway had dramaticlly change.
ggplot(ccrb, aes(ccrb$`Incident Year`,fill=ccrb$`Incident Location`)) +geom_bar() +guides(fill=guide_legend(title = "Incident Location"))
From below graph, we can tell that during those years, Brooklyn always have the most incident happened every year, followed by Bronx, Manhattan and Queens.
ggplot(ccrb, aes(ccrb$`Incident Year`,fill=ccrb$`Borough of Occurrence`)) +geom_bar() +guides(fill=guide_legend(title = "Incident Area"))+theme_dark()
From below graph, we can tell that having a video evidence can significant increase the opportunity that the case is fully investigated. Most of the cases with a video evidence is fully investigated while the majority of cases without a video evidence is not fully investigated.
ggplot(ccrb, aes(ccrb$`Complaint Has Video Evidence`,fill=ccrb$`Is Full Investigation`))+geom_bar() +guides(fill=guide_legend(title = "Fully investigated?"))+theme_classic()
ggplot(ccrb, aes(ccrb$`Allegation FADO Type`,na.rm = TRUE)) +geom_bar(width = 0.5, position = position_dodge(width = 1)) +theme_bw()
From below graph, we can tell that most of the people are arrested in a Force type of incident. And most of people are not arrested in a Abuse of Authority type of incident.
ggplot(ccrb, aes(ccrb$`Allegation FADO Type`,fill=ccrb$`Encounter Outcome`)) +geom_bar(width = 0.5, position = position_dodge(width = 0.5))+guides(fill=guide_legend(title = "Outcome"))
From this gragh, we can tell that Physical force and Word are the most frequent incidents types.
ggplot(ccrb, aes(ccrb$`Allegation Description`)) +geom_bar(width = 0.5, position = position_dodge(width = 0.5))+ theme(axis.text.x=element_text(angle=90, hjust=1))
a<-subset(ccrb,ccrb$`Allegation Description`=="Physical force" & ccrb$`Encounter Outcome`=="Arrest")
ggplot(a,aes(a$`Incident Year`,fill=a$`Borough of Occurrence`))+ geom_bar()+guides(fill=guide_legend(title = "Incident Area"))+labs(title="Physical Force with Arrested Happened in Each Area",y = 'Number of Incident', x = 'Incident Year') + coord_flip() +theme_classic()
From this graph, we can tell that most of people filed their case via phone call. Even though high tech is becoming the trend these years, phone call is still the most popular way to file an incident case. Fax and Email are rarely used.
ggplot(ccrb,aes(ccrb$`Received Year`,fill=ccrb$`Complaint Filed Mode`))+ geom_bar(aes(y = (..count..)/sum(..count..)))+guides(fill=guide_legend(title = "Complaint Filed Mode"))+labs(title="Did Complaint Filed Mode Change During Those Years?",y = 'Count', x = 'Incident Year') + coord_flip() +theme_classic()+ scale_y_continuous(labels = scales::percent)
From this graph, we can tell that most of people filed their cases either at CCRB or IAB. Compare these two places, CCRB has completed more cases with fully investigated status.
ggplot(ccrb, aes(ccrb$`Complaint Filed Place`,fill=ccrb$`Is Full Investigation`)) +geom_bar(width = 0.5, position = position_dodge(width = 0.5))+guides(fill=guide_legend(title = "Fully Investigated"))+theme(axis.text.x=element_text(angle=90, hjust=1))+labs(title="Filing Place Affect the Outcome?",y = 'Count', x = 'Filed Place')