Source: data from within R - USArrests
data("USArrests")
head(USArrests)
## Murder Assault UrbanPop Rape
## Alabama 13.2 236 58 21.2
## Alaska 10.0 263 48 44.5
## Arizona 8.1 294 80 31.0
## Arkansas 8.8 190 50 19.5
## California 9.0 276 91 40.6
## Colorado 7.9 204 78 38.7
How is the urban population distributed?
It appears that the urban population averages between 60 and 70.
From looking at the few records of the data, it is obvious more arrests are made due to assaults. How about murder and rape? Which of the two is reported most?
The box plot below indicates that on average more arrests are made due to rape assaults.
# use colors() to get different colors
boxplot(USArrests$Murder,USArrests$Rape, names=c("Murder","Rape"),col=c("red", "royalblue2"),main="USA Arrests")
# x-axis label
# side: which side(1=bottom, 2=left, 3=top, 4=right)
# line: which margin line, starts at 0
mtext("Assault Type", side=1, line=3, font=2, col="blue")
Do highly populated urban areas have more crimes?
It seems higher populated areas experience more crimes.
plot((USArrests$Rape+USArrests$Murder+USArrests$Assault) ~ USArrests$UrbanPop, col="dark red", main="Population Vs. Arrests",
ylab="# of Arrests", xlab="Population")