Chapter 22 Type of Crime and Reporting District
We examine the various types of Crime happenning in the Reporting Districts. We plot the Top 20 items in the bar plot.
LACrime %>%
group_by(CrimeCodeDescription,ReportingDistrict) %>%
tally() %>%
arrange(desc(n)) %>%
head(20) %>%
mutate(ReportingDistrict = reorder(ReportingDistrict,n)) %>%
ggplot(aes(x = ReportingDistrict,y = n,fill = CrimeCodeDescription)) +
geom_bar(stat='identity',colour="white") +
labs(x = 'ReportingDistrict', y = 'Count of Incidents',
title = 'ReportingDistrict and CrimeCodeDescription') +
coord_flip() +
theme_bw() + theme(legend.position="top")
Shoplifting Petty Theft and Theft Plain are the Top Two most Common Crimes.