Whittle Unique Conflict Onset-Years from Conflict-Year Data
Source:R/whittle_conflicts_onsets.R
whittle_conflicts_onsets.Rd
whittle_conflicts_reciprocation()
is in a class of
do-it-yourself functions for coercing (i.e. "whittling") conflict-year
data with cross-sectional units to unique conflict-year data by
cross-sectional unit. The inspiration here is clearly the problem
of whittling dyadic dispute-year data into true dyad-year data (like in
the Gibler-Miller-Little conflict data). This particular
function will drop ongoing conflicts in the presence of unique onsets.
Arguments
- data
a data frame with a declared conflict attribute type.
- ...
optional, only to make the shortcut work
Value
whittle_conflicts_onsets()
takes a dyad-year data frame
or leader-dyad-year data frame with a declared conflict attribute type
and, grouping by the dyad and year, returns just those observations with
unique onsets where duplicates exist. This will not eliminate all
duplicates, far from it, but it's a sensible place to start.
Details
Dyads are capable of having multiple disputes in a given year,
which can create a problem for merging into a complete dyad-year
data frame. Consider the case of France and Italy in 1860, which
had three separate dispute onsets that year (MID#0112, MID#0113, MID#0306),
as illustrative of the problem. The default process in peacesciencer
employs several rules to whittle down these duplicate dyad-years for
merging into a dyad-year data frame. These are available in
add_cow_mids()
and add_gml_mids()
.
wc_onsets()
is a simple, less wordy, shortcut for the same function.
References
Miller, Steven V. 2021. "How peacesciencer Coerces Dispute-Year Data into Dyad-Year Data". URL: http://svmiller.com/peacesciencer/articles/coerce-dispute-year-dyad-year.html
Examples
# \donttest{
# just call `library(tidyverse)` at the top of the your script
library(magrittr)
gml_dirdisp %>% whittle_conflicts_onsets()
#> # A tibble: 9,802 × 40
#> dispnum ccode1 ccode2 year midongoing midonset sidea1 sidea2 revstate1
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 2 2 200 1902 1 1 1 0 1
#> 2 2 200 2 1902 1 1 0 1 1
#> 3 3 300 345 1913 1 1 1 0 1
#> 4 3 345 300 1913 1 1 0 1 0
#> 5 4 200 339 1946 1 1 0 1 0
#> 6 4 339 200 1946 1 1 1 0 0
#> 7 7 200 651 1951 1 1 1 0 0
#> 8 7 200 651 1952 1 0 1 0 0
#> 9 7 651 200 1951 1 1 0 1 1
#> 10 7 651 200 1952 1 0 0 1 1
#> # ℹ 9,792 more rows
#> # ℹ 31 more variables: revstate2 <dbl>, revtype11 <dbl>, revtype12 <dbl>,
#> # revtype21 <dbl>, revtype22 <dbl>, fatality1 <dbl>, fatality2 <dbl>,
#> # fatalpre1 <dbl>, fatalpre2 <dbl>, hiact1 <dbl>, hiact2 <dbl>,
#> # hostlev1 <dbl>, hostlev2 <dbl>, orig1 <dbl>, orig2 <dbl>, hiact <dbl>,
#> # hostlev <dbl>, mindur <dbl>, maxdur <dbl>, outcome <dbl>, settle <dbl>,
#> # fatality <dbl>, fatalpre <dbl>, stmon <dbl>, endmon <dbl>, recip <dbl>, …
cow_mid_dirdisps %>% whittle_conflicts_onsets()
#> # A tibble: 10,874 × 19
#> dispnum ccode1 ccode2 year dispongoing disponset sidea1 sidea2 fatality1
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 2 2 200 1902 1 1 1 0 0
#> 2 2 200 2 1902 1 1 0 1 0
#> 3 3 300 345 1913 1 1 1 0 0
#> 4 3 345 300 1913 1 1 0 1 0
#> 5 4 200 339 1946 1 1 0 1 2
#> 6 4 339 200 1946 1 1 1 0 0
#> 7 7 200 651 1951 1 1 1 0 1
#> 8 7 200 651 1952 1 0 1 0 1
#> 9 7 651 200 1951 1 1 0 1 2
#> 10 7 651 200 1952 1 0 0 1 2
#> # ℹ 10,864 more rows
#> # ℹ 10 more variables: fatality2 <dbl>, fatalpre1 <dbl>, fatalpre2 <dbl>,
#> # hiact1 <dbl>, hiact2 <dbl>, hostlev1 <dbl>, hostlev2 <dbl>, orig1 <dbl>,
#> # orig2 <dbl>, duplicated <dbl>
# }