Visualization of Violent Crime Rates

Violent crime rates in US (1973)

Paul Lim Min Chim
Insitute for Infocomm Research

Introduction

For this app, I have used the USArrests dataset, which comes with R datasets package. This dataset contains arrest statistics for assault, murder, and rape in each of the 50 US states in 1973 and the percentage of the population living in urban areas. The structure of the dataset is as follows:

  • Murder: number of murder arrests (per 100,000 residents)
  • Assault: number of assault arrests (per 100,000 residents)
  • UrbanPop: percentage of urban population
  • Rape: number of rape arrests (per 100,000 residents)

How To Use The App

The app provides an intuitive way to visualize the data through an interactive map (choropleth).

  • To use the app, select the violent crime type from the dropdown box to display the crime rate for each state as indicated by the color code.
  • The map uses a color legend that reflects the severity of violent crime rate for each state, where blue indicates low crime rate and red indicates high crime rate.
  • The average & standard deviation is also computed and displayed.
  • If you hover your mouse pointer over a state, the number of arrests will be displayed.

Bar Plot of Violent Crime Rates

Let's compare the various violent crime rates for each of the states using a simple bar plot.

ArrestStats <- cbind(USArrests$Murder, USArrests$Assault, USArrests$Rape)
colnames(ArrestStats) <- c("Murder", "Assault", "Rape") 
rownames(ArrestStats) <- row.names(USArrests)
barplot(t(ArrestStats), beside=T, ylab="Arrest rate per 100,000 residents", 
        legend.text = c("Murder", "Assault", "Rape"), args.legend = list(x = "topright"),
        las=2, col=c("darkblue", "green", "red"), main = "Crime Rate in US (1973)")

plot of chunk unnamed-chunk-1

Credits