R/add_cow_to_gwcode.R
add_cow_to_gwcode.Rd
add_cow_to_gwcode()
allows you to match, as well as one can, Correlates of War system membership data
with Gleditsch-Ward system data.
add_cow_to_gwcode(data)
data | a dyad-year data frame (either "directed" or "non-directed") or a state-year data frame. |
---|
add_cow_to_gwcode()
takes a dyad-year data frame or state-year data frame that already has Gleditsch-Ward
state system codes and adds their corollary Correlates of War codes.
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 Gran Colombia is not too difficult to handle (i.e.
CoW does not have this entity and none of the splinter states conflict with CoW's coding). However, there is greater weirdness with a case like the unification of
West Germany and East Germany. Herein, Correlates of War treats the unification as the reappearance of the original Germany whereas
Gleditsch-Ward treat the unification as an incorporation of East Germany into West Germany. The script will *not* create state-year or dyad-year duplicates
for the Gleditsch-Ward codes. The size of the original data remain unchanged. However, there will be some year duplicates for various
Correlates of War codes (prominently Serbia and Yugoslavia in 2006). 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.
Steven V. Miller
# just call `library(tidyverse)` at the top of the your script library(magrittr) create_dyadyears(system = "gw") %>% add_cow_to_gwcode()#> # A tibble: 2,029,660 x 5 #> gwcode1 gwcode2 year ccode1 ccode2 #> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 2 20 1867 2 NA #> 2 2 20 1868 2 NA #> 3 2 20 1869 2 NA #> 4 2 20 1870 2 NA #> 5 2 20 1871 2 NA #> 6 2 20 1872 2 NA #> 7 2 20 1873 2 NA #> 8 2 20 1874 2 NA #> 9 2 20 1875 2 NA #> 10 2 20 1876 2 NA #> # … with 2,029,650 more rows#>#> # A tibble: 18,289 x 4 #> gwcode statename year ccode #> <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 18,279 more rows