Description Usage Format Source References Examples
A data set containing murders for the years 2008 through 2016 in the City of St. Louis.
1 |
A tibble with 1394 rows and 11 variables:
SLMPD record number
string date in dmy format for when murder occurred
year murder occurred
month murder occurred
day of month murder occurred
time murder occurred in 24-hour clock
HOMICIDE
SLMPD district where murder occurred
neighborhood where murder occurred, see for values
house address where murder occurred
street where murder occurred
St. Louis Metropolitan Police Department; original data cleaning and data set construction by Taylor Braswell
Asher, J. (2017, January 9). U.S. Cities Experienced Another Big Rise In Murder In 2016. FiveThiryEight, retrived from website.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | str(stl_tbl_murders)
head(stl_tbl_murders)
if (require("dplyr") & require("ggplot2")) {
# what is the neighborhood with the most murders?
stl_tbl_murders %>%
group_by(nhood) %>%
summarize(n_obs = n()) %>%
arrange(desc(n_obs))
# top neighborhoods: 50 is Wells Goodfellow and 59 is Jeff Vanderlou
# how have murders changed over time?
stl_tbl_murders %>%
group_by(year) %>%
summarize(n_obs = n()) %>%
arrange(year) %>%
ggplot(aes(x = year, y = n_obs)) +
geom_bar(stat="identity") +
scale_x_continuous(breaks = c(2008:2016),
labels = factor(2008:2016))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.