Skip to contents

add_gwcode_to_cow() allows you to match, as well as one can, Gleditsch-Ward system membership data with Correlates of War state system membership data.

Usage

add_gwcode_to_cow(data)

Arguments

data

a data frame with appropriate peacesciencer attributes

Value

add_gwcode_to_cow() takes a (dyad-year, leader-year, leader-dyad-year, state-year) data frame that already has Correlates of War state system codes and adds their corollary Gleditsch-Ward codes.

Details

The data-raw directory on the project's Github contains more information about the underlying data that assists in merging in these codes.

The user will invariably need to be careful and ask why they want these data included. The issue here is that both have a different composition and the merging process will not (and cannot) be perfect. We can note that a case like Serbia/Yugoslavia is not too difficult to handle (since "Serbia" never overlaps with "Yugoslavia" in the Gleditsch-Ward data and Correlates of War understands Serbia as the predecessor state, dominant state, and successor state to Yugoslavia). However, there is greater weirdness with a case like Yemen/Yemen Arab Republic. The script will not create state-year or dyad-year duplicates for the Correlates of War codes. The size of the original data remain unchanged. However, there will be some year duplicates for various Gleditsch-Ward codes (e.g. Yemen, again). Use with care. You can also use the countrycode package. Whether you use this function or the countrycode package, do not do this kind of merging without assessing the output.

Author

Steven V. Miller

Examples

# just call `library(tidyverse)` at the top of the your script
library(magrittr)

cow_ddy %>% add_gwcode_to_cow()
#> # A tibble: 2,101,440 × 5
#>    ccode1 ccode2  year gwcode1 gwcode2
#>     <dbl>  <dbl> <dbl>   <dbl>   <dbl>
#>  1      2     20  1920       2      20
#>  2      2     20  1921       2      20
#>  3      2     20  1922       2      20
#>  4      2     20  1923       2      20
#>  5      2     20  1924       2      20
#>  6      2     20  1925       2      20
#>  7      2     20  1926       2      20
#>  8      2     20  1927       2      20
#>  9      2     20  1928       2      20
#> 10      2     20  1929       2      20
#> # … with 2,101,430 more rows

create_stateyears() %>% add_gwcode_to_cow()
#> Joining, by = c("ccode", "year")
#> # A tibble: 16,926 × 4
#>    ccode statenme                  year gwcode
#>    <dbl> <chr>                    <dbl>  <dbl>
#>  1     2 United States of America  1816      2
#>  2     2 United States of America  1817      2
#>  3     2 United States of America  1818      2
#>  4     2 United States of America  1819      2
#>  5     2 United States of America  1820      2
#>  6     2 United States of America  1821      2
#>  7     2 United States of America  1822      2
#>  8     2 United States of America  1823      2
#>  9     2 United States of America  1824      2
#> 10     2 United States of America  1825      2
#> # … with 16,916 more rows