title: ‘Problem Set 4’

Xuechun Chen

library(readxl)
library(ggplot2)

ccrb = read_excel("/Users/xuechun/Desktop/ccrb_datatransparencyinitiative (1).xlsx", sheet = "Complaints_Allegations")

Viz 1 I would like to know the number of each type of allegation. This can help to better understand what’s the most complained type of allegation of NYPD. After running and analyzing this Viz, I think NYPD need to educate their police officers how to use their authority correctly (within a reasonable range).

ggplot(ccrb, aes(x=ccrb$"Allegation FADO Type", fill=ccrb$"Allegation FADO Type")) +
  geom_bar(stat = "count") +
  labs(title="Number of Complain by Allegation Type", x="Allegation Type", y="Number of Complain") +
  scale_fill_discrete(name="Allegation Type")

Viz 2 I was wondering of why the total number of complaints dropped during the past few years. After running several analyses, The location of incident has some interesting trends. Based on the graph below, incidents happened on Street/highway have decreased tremendously. Given the fact that the number of other incidents didn’t changed a lot. The decreasing of incidents happened on Street/highway might be the reason why the overall numbers of complaints dropped.

ggplot(ccrb,aes(x=ccrb$"Incident Year",color=ccrb$"Incident Location"))+
  geom_point(stat="count")+
  labs(title="Frequency of Incident by Location", x="Year", y="Number") +
  scale_fill_discrete(name="Location")+
  theme(legend.position = "bottom")