Chapter 18 Reporting District Incidents
We examine the Reporting Districts which report the maximum number of Crimes. The bar plot shows the Top 20 Reporting Districts which report Crimes.
RDGeoLocation = LACrime %>%
group_by(ReportingDistrict) %>%
summarise(RDlat = median(latitude,na.rm = TRUE)
,RDlon = median(longitude,na.rm = TRUE)
,CountIncidents = n()) %>%
arrange(desc(CountIncidents)) %>%
head(50)
head(RDGeoLocation,20) %>%
mutate(ReportingDistrict = reorder(ReportingDistrict,CountIncidents)) %>%
ggplot(aes(x = ReportingDistrict,y = CountIncidents)) +
geom_bar(stat='identity',colour="white", fill =fillColor) +
geom_text(aes(x = ReportingDistrict, y = 1, label = paste0("(",CountIncidents,")",sep="")),
hjust=0, vjust=.5, size = 4, colour = 'black',
fontface = 'bold') +
labs(x = 'ReportingDistrict', y = 'Count of Incidents',
title = 'Count of Incidents in Reporting District') +
coord_flip() +
theme_bw()