# Regional Variation in Law Enforcement Deaths – Part B

February 16, 2011
By

(This article was first published on Mathew Analytics LLC » R, and kindly contributed to R-bloggers)

I would like to thank Tal Galili for establishing and maintaining the blog aggregator at R-bloggers. This site has been added to their directory and new posts which are tagged with R will now appear on their feed.

https://www.r-bloggers.com/

In part a, I presented a series of barplots which showed that the plurality of police officer killings from 1998 to 2007 occured in the southern region of the United States. Using the same data, I will examine whether there were any significant differences in the yearly number of officers killed in all four regions.

```gplot(totnec, aes(Year, Value)) +
geom_bar(fill="#336699", colour="black") +
ylim(c(0,10)) + opts(title="Number of Police Officers Killed in the Northeast (1998-2007)") +
opts(axis.text.y=theme_text(family="sans", face="bold")) +
opts(axis.text.x=theme_text(family="sans", face="bold")) +
opts(plot.title = theme_text(size=15, face="bold")) +
xlab("") + ylab("")

ggplot(totmidc, aes(Year, Value)) + geom_bar() +
geom_bar(fill="#336699", colour="black") +
ylim(c(0,20)) + opts(title="Number of Police Officers Killed in the Midwest (1998-2007)") +
opts(axis.text.y=theme_text(family="sans", face="bold")) +
opts(axis.text.x=theme_text(family="sans", face="bold")) +
opts(plot.title = theme_text(size=15, face="bold")) +
xlab("") + ylab("")

ggplot(totsoc, aes(Year, Value)) + geom_bar() +
geom_bar(fill="#336699", colour="black") +
ylim(c(0,50)) + opts(title="Number of Police Officers Killed in the South (1998-2007)") +
opts(axis.text.y=theme_text(family="sans", face="bold")) +
opts(axis.text.x=theme_text(family="sans", face="bold")) +
opts(plot.title = theme_text(size=15, face="bold")) +
xlab("") + ylab("")

ggplot(totwec, aes(Year, Value)) + geom_bar() +
geom_bar(fill="#336699", colour="black") +
ylim(c(0,30)) + opts(title="Number of Police Officers Killed in the West (1998-2007)") +
opts(axis.text.y = theme_text(family="sans", face="bold")) +
opts(axis.text.x=theme_text(family="sans", face="bold")) +
opts(plot.title = theme_text(size=15, face="bold")) +
xlab("") + ylab("")```

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

Tags: , ,