dataset_paper.Rmd
We originally published the ARVIG dataset in 2016 and documented it in [@bencek_2016]. The following code can be run in order to replicate all figures and tables in this paper.
As we have continually updated the ARVIG dataset and information was also added and corrected retroactively, we first need to install the version of the dataset used in the original publication.
#devtools::install_github("davben/arvig", ref = "")
library(tidyverse)
## Warning: Paket 'tidyverse' wurde unter R Version 3.4.4 erstellt
## -- Attaching packages ------------------------------------------------------------------------------------------------- tidyverse 1.2.1 --
## v ggplot2 2.2.1.9000 v purrr 0.2.4
## v tibble 1.3.4 v dplyr 0.7.4
## v tidyr 0.8.0 v stringr 1.3.1
## v readr 1.1.1 v forcats 0.3.0
## Warning: Paket 'tidyr' wurde unter R Version 3.4.4 erstellt
## Warning: Paket 'purrr' wurde unter R Version 3.4.4 erstellt
## Warning: Paket 'dplyr' wurde unter R Version 3.4.3 erstellt
## Warning: Paket 'stringr' wurde unter R Version 3.4.4 erstellt
## Warning: Paket 'forcats' wurde unter R Version 3.4.4 erstellt
## -- Conflicts ---------------------------------------------------------------------------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(arvig)
First we can create an overview table distinguishing the different types of events present in the data.
arvig %>%
count(category_en) %>%
arrange(desc(n))
## # A tibble: 9 x 2
## category_en n
## <chr> <int>
## 1 miscellaneous attack 4825
## 2 assault 1004
## 3 demonstration 541
## 4 arson 296
## 5 suspicion 211
## 6 other 25
## 7 miscellaneous attack & assault 12
## 8 arson & miscellaneous attack 2
## 9 demonstration & miscellaneous attack 2
A few observations are mapped to more than one event type. In order to break those down to the raw categories, arvig
offers the function split_events()
that creates additional observations for each category.
arvig_split <- arvig %>%
split_events()