[TRIGGER WARNING: VIOLENCE. MURDER]
The data can be explored through this website: [https://tdor.translivesmatter.info/]
knitr::opts_chunk$set(echo = TRUE)
Load required packages.
library(dplyr) library(ggplot2) library(ggthemes) library(lubridate) library(maps) library(tdor)
The TDoR 2019 period goes from 1st of Oct 2018 to 30th of Sep 2019. The
relevant records can be obtained using the TDoR
variable.
How many deaths have occured in this time?
year <- 2019 start <- make_date(year, 10, 1) end <- make_date(year, 9, 30) tdor %>% filter(TDoR == year) -> tdor_subset
There were r nrow(tdor_subset)
deaths reported between r start
and r end
.
tdor_subset %>% mutate(yrmth = make_date(Year, Month, 1)) %>% ggplot(aes(yrmth)) + geom_bar() + labs(title = "Deaths by month", x = "", subtitle = paste("between", start, "and", end), y = "Deaths") + theme_bw()
Where we have ages... what were those ages?
tdor_subset %>% ggplot(aes(x = (`Age min` + `Age max`)/2)) + geom_bar() + ggtitle("Deaths by age") + labs(y = "Deaths", x = "Age at death", subtitle = paste("between", start, "and", end)) + theme_bw()
tdor_subset %>% group_by(Country) %>% summarise(n = n()) %>% arrange(desc(n)) -> by_country ggplot(by_country[1:10,], aes(x = Country, y = n)) + theme_bw() + labs(y = "Deaths", x = "") + geom_bar(stat="identity") + theme(axis.text.x = element_text(angle=45, hjust=1)) + labs(title = "Ten countries with the most reported deaths", subtitle = paste("betweeen", start, "and", end))
world <- ggplot() + borders("world", colour = "gray85", fill = "gray80") + theme_map() map <- world + geom_point(aes(x = Longitude, y = Latitude), data = tdor_subset, colour = 'purple', alpha = .2) + ggtitle(paste("Map of deaths betweeen", start, "and", end)) map
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.