Exploratory data visualization

Civilian Complaint Review Board (CCRB)

1. Incident Yearly Trend

The second graph shows how people filed the complaints. From the chart we can see that people primarily called to file the complaints.

ggplot(df, aes(df$Incident.Year)) +
  geom_freqpoly(binwidth = 1, color = "pink") +
  geom_text(stat='count', aes(label = ..count.., vjust = 0)) +
  labs(title = "Incident Yearly Trend", x= "Year", y= "Incident Count") +
  theme_bw()

2. Borough of Occurence

From the first graph we can see the allocation of locations with the number of incidents occured. Surpringly, Manhattan is at the third place when it comes to the amount of incidents happend. The first one is Brooklyn with

ggplot(df, aes(df$Borough.of.Occurrence)) +
  geom_bar(fill = "steelblue") +
  geom_text(stat='count', aes(label = ..count.., vjust = 0)) +
  labs(title = "Incident Location", x = "Borough of Occurence", y = "Incident") + 
  theme_bw()

3. Complaints Filed Mode

The second graph shows how people filed the complaints. From the chart we can see that people primarily called to file the complaints.

ggplot(df, aes(df$Complaint.Filed.Mode)) +
  geom_bar(fill = "steelblue") +
  geom_text(stat='count', aes(label = ..count.., vjust = 0)) +
  labs(title = "Complaints Filed Mode", x = "Complaints Filed Mode", y = "Count") + 
  theme_bw()

4. Borough of Occurence by Complaint Filed Mode

In this chart I would like to show the allocation of how the complaints were filed with different locations to see if people have didfernt preference on filing the complaints based on areas. As we can see in the chart, the allocation is pretty equally distributed.

ggplot(df) + 
  geom_bar(aes(x = df$Borough.of.Occurrence, fill = df$Complaint.Filed.Mode)) +
  labs(title = "Incident Location by complain filed mode", y= "Count", x= "Borough of Occurence")+
  scale_fill_discrete(name = "Complaint Filed Mode")

5. Borough of Occurence by Incident Location

In this chart I would like to show the allocation of the incident locations with different areas.

ggplot(df) + 
  geom_bar(aes(x = df$Borough.of.Occurrence, fill = df$Incident.Location)) +
  labs(title = "Incident Area by Incident Location", y= "Count", x= "Borough of Occurence")+
  scale_fill_discrete(name = "Incident Loaction")

6. Allegation FADO Type by Borough of Occurrence

This chart shows the allocaiton of allegation FADO type by the borough of occurrence

ggplot(df) + 
  geom_bar(aes(x = df$Borough.of.Occurrence, fill = df$Allegation.FADO.Type)) +
  labs(title = "Allegation FADO Type by Borough of Occurrence", y= "Count", x= "Borough of Occurence")+
  scale_fill_discrete(name = "Allegation FADO Type")

7. Encounter outcome by allrgation FADO type

ggplot(df) + 
  geom_bar(aes(x = df$Allegation.FADO.Type, fill = df$Encounter.Outcome)) +
  labs(title = "Encounter outcome by allrgation FADO type", y= "Count", x= "Allegation FADO Type")+
  scale_fill_discrete(name = "Encounter Outcome")

8. Allegation FADO Type by Year

The chart shows the yearly trend on different Allegations FADO types

ggplot(df) + 
  geom_bar(aes(x = df$Received.Year, fill = df$Allegation.FADO.Type)) +
  labs(title = "Yearly trend for Allrgation FADO type", y= "Count", x= "Allegation FADO Type")+
  scale_fill_discrete(name = "Allrgation FADO type")

9. Incident Location by Year

ggplot(df) + 
  geom_bar(aes(x = df$Received.Year, fill = df$Incident.Location)) +
  labs(title = "Incident Location by Year", y= "Count", x= "Year")+
  scale_fill_discrete(name = "Incident Location")

10. Complaints Contains Stop & Frisk Allegation vs. Is Full Investigation

ggplot(df) + 
  geom_bar(aes(x = df$Received.Year, fill = df$Complaint.Contains.Stop...Frisk.Allegations)) +
  labs(title = "Frisk Allegation vs. Is Full Investigation by Year", y= "Count", x= "Year")+
  scale_fill_discrete(name = "Frisk Allegation vs. Is Full Investigation")