Learn R Programming

peacesciencer (version 0.4.0)

add_peace_years: Add Peace Years to Your Conflict Data

Description

add_peace_years() calculates peace years for your ongoing dyadic conflicts. The function works for both the CoW-MID data and the Gibler-Miller-Little (GML) MID data.

Usage

add_peace_years(data, pad = FALSE)

Arguments

data

a dyad-year data frame (either "directed" or "non-directed")

pad

an optional parameter, defaults to FALSE. If TRUE, the peace-year calculations fill in cases where panels are unbalanced/have gaps. Think of a state like Germany disappearing for 45 years as illustrative of this.

If keep is not specified in the function, the ensuing output returns everything.

Value

add_peace_years() takes a dyad-year data frame and adds peace years for ongoing dyadic conflicts.

Details

The function internally uses sbtscs() from stevemisc. In the interest of full disclosure, sbtscs() leans heavily on btscs() from DAMisc. I optimized some code for performance.

References

Armstrong, Dave. 2016. ``DAMisc: Dave Armstrong's Miscellaneous Functions.'' R package version 1.4-3.

Miller, Steven V. 2017. ``Quickly Create Peace Years for BTSCS Models with sbtscs in stevemisc.'' http://svmiller.com/blog/2017/06/quickly-create-peace-years-for-btscs-models-with-stevemisc/

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
# just call `library(tidyverse)` at the top of the your script
library(magrittr)
cow_ddy %>%
add_gml_mids(keep = NULL) %>%
add_cow_mids(keep = NULL) %>%
add_contiguity() %>%
add_cow_majors() %>%
filter_prd()  %>%
add_peace_years()
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab