add_ucdp_onsets()
allows you to add information about conflict episode onsets from the UCDP
data program to state-year data.
Value
add_ucdp_onsets()
takes a state-year data frame and adds a few summary
variables based off armed conflict onsets data provided by UCDP. The variables returned are
the sum of new conflict dyads (should they exist) in a given state-year, and the sum of new onset episodes (or new conflicts) that are
separated by one, two, three, five, or 10 years since the last conflict episode.
Details
The function leans on attributes of the data that are provided by the create_dyadyear()
or
create_stateyear()
function. Make sure that function (or data created by that function) appear at the top
of the proverbial pipe. The underlying data are version 19.1. Importantly, the UCDP yearly onset data are nominally state-year,
but technically state-dyad-episode-year for cases of onsets. For example, there are four France-1946 observations because of four
new conflict episodes with Cambodia, Laos, Thailand, and Vietnam. There are two Panama-1989 episodes, one for the invasion by
the United States and another for a failed coup attempt. That means the are duplicates in the original data that I process
into summaries. The user will probably want to consider some kind of recoding here.
References
Gleditsch, Nils Petter; Peter Wallensteen, Mikael Eriksson, Margareta Sollenberg & Havard Strand (2002) Armed Conflict 1946–2001: A New Dataset. Journal of Peace Research 39(5): 615–637.
Pettersson, Therese; Stina Hogbladh & Magnus Oberg (2019). Organized violence, 1989-2018 and peace agreements. Journal of Peace Research 56(4): 589-603.
Examples
# \donttest{
# just call `library(tidyverse)` at the top of the your script
library(magrittr)
library(dplyr)
create_stateyears(system="gw") %>% add_ucdp_onsets()
#> Joining with `by = join_by(gwcode, year)`
#> # A tibble: 18,637 × 9
#> gwcode statename year sumnewconf sumonset1 sumonset2 sumonset3 sumonset5
#> <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 2 United State… 1816 0 0 0 0 0
#> 2 2 United State… 1817 0 0 0 0 0
#> 3 2 United State… 1818 0 0 0 0 0
#> 4 2 United State… 1819 0 0 0 0 0
#> 5 2 United State… 1820 0 0 0 0 0
#> 6 2 United State… 1821 0 0 0 0 0
#> 7 2 United State… 1822 0 0 0 0 0
#> 8 2 United State… 1823 0 0 0 0 0
#> 9 2 United State… 1824 0 0 0 0 0
#> 10 2 United State… 1825 0 0 0 0 0
#> # ℹ 18,627 more rows
#> # ℹ 1 more variable: sumonset10 <dbl>
create_stateyears() %>%
add_gwcode_to_cow() %>% add_ucdp_onsets()
#> Joining with `by = join_by(ccode, year)`
#> Joining with `by = join_by(year, gwcode)`
#> # A tibble: 17,121 × 10
#> ccode statenme year gwcode sumnewconf sumonset1 sumonset2 sumonset3
#> <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 2 United States of… 1816 2 0 0 0 0
#> 2 2 United States of… 1817 2 0 0 0 0
#> 3 2 United States of… 1818 2 0 0 0 0
#> 4 2 United States of… 1819 2 0 0 0 0
#> 5 2 United States of… 1820 2 0 0 0 0
#> 6 2 United States of… 1821 2 0 0 0 0
#> 7 2 United States of… 1822 2 0 0 0 0
#> 8 2 United States of… 1823 2 0 0 0 0
#> 9 2 United States of… 1824 2 0 0 0 0
#> 10 2 United States of… 1825 2 0 0 0 0
#> # ℹ 17,111 more rows
#> # ℹ 2 more variables: sumonset5 <dbl>, sumonset10 <dbl>
# Recall, these are summaries. You'll need to post-process to what you want.
create_stateyears(system="gw") %>%
add_ucdp_onsets() %>%
mutate(onset = ifelse(sumonset1 > 0, 1, 0))
#> Joining with `by = join_by(gwcode, year)`
#> # A tibble: 18,637 × 10
#> gwcode statename year sumnewconf sumonset1 sumonset2 sumonset3 sumonset5
#> <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 2 United State… 1816 0 0 0 0 0
#> 2 2 United State… 1817 0 0 0 0 0
#> 3 2 United State… 1818 0 0 0 0 0
#> 4 2 United State… 1819 0 0 0 0 0
#> 5 2 United State… 1820 0 0 0 0 0
#> 6 2 United State… 1821 0 0 0 0 0
#> 7 2 United State… 1822 0 0 0 0 0
#> 8 2 United State… 1823 0 0 0 0 0
#> 9 2 United State… 1824 0 0 0 0 0
#> 10 2 United State… 1825 0 0 0 0 0
#> # ℹ 18,627 more rows
#> # ℹ 2 more variables: sumonset10 <dbl>, onset <dbl>
# }