Skip to contents

add_cow_trade() allows you to add Correlates of War trade data to your (dyad-year, leader-year, leader-dyad-year, state-year) data frame

Usage

add_cow_trade(data)

Arguments

data

a data frame with appropriate peacesciencer attributes

Value

add_cow_trade() takes a (dyad-year, leader-year, leader-dyad-year, state-year) data frame and adds information about the volume of trade in that given dyad-year or state-year. For the state-year (leader-year) data, these are minimally the sum of all imports and the sum of all exports. For dyad-year (leader-dyad-year) data, this function returns the value of imports in current million USD in the first country from the second country (and vice-versa) along with their "smooth" equivalents.

Details

For the dyad-year (and leader-dyad-year) data, there must be some kind of information loss in order to work within the limited space available to this package. This package loads a truncated version of the data in which the trade values are rounded to three decimal points in order to greatly reduce the disk space for this package. I do not think this to be terribly problematic, though I admit I do not like it. If this is a problem for your research question, you may want to consider not using this function for dyad-year or leader-dyad-year data.

Be mindful that the data are fundamentally state-year or dyad-year and that extensions to leader-level data should be understood as approximations for leaders (leader-dyads) in a given state-year (dyad-year).

References

Barbieri, Katherine, Omar M. G. Keshk, and Brian Pollins. 2009. "TRADING DATA: Evaluating our Assumptions and Coding Rules." Conflict Management and Peace Science. 26(5): 471-491.

Author

Steven V. Miller

Examples

# just call `library(tidyverse)` at the top of the your script
library(magrittr)
# The function below works, but depends on running `download_extdata()` beforehand.
# cow_ddy %>% add_cow_trade()

create_stateyears() %>% add_cow_trade()
#> Joining with `by = join_by(ccode, year)`
#> # A tibble: 17,121 × 5
#>    ccode statenme                  year imports exports
#>    <dbl> <chr>                    <dbl>   <dbl>   <dbl>
#>  1     2 United States of America  1816      NA      NA
#>  2     2 United States of America  1817      NA      NA
#>  3     2 United States of America  1818      NA      NA
#>  4     2 United States of America  1819      NA      NA
#>  5     2 United States of America  1820      NA      NA
#>  6     2 United States of America  1821      NA      NA
#>  7     2 United States of America  1822      NA      NA
#>  8     2 United States of America  1823      NA      NA
#>  9     2 United States of America  1824      NA      NA
#> 10     2 United States of America  1825      NA      NA
#> # ℹ 17,111 more rows