filter_prd() filters a dyad-year data frame to just those that are "politically relevant." This is useful for discarding unnecessary (and unwanted) observations that just consume space in memory.

filter_prd(data)

Arguments

data

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

Value

filter_prd() takes a dyad-year data frame, assuming it has columns for major power status and contiguity type, calculates whether the dyad is "politically relevant", and subsets the data frame to just those observations.

Details

"Political relevance" can be calculated a few ways. Right now, the function considers only "direct" contiguity and Correlates of War major power status. You can employ maximalist definitions of "direct contiguity" to focus on just the land-contiguous. This function is inclusive of any type of contiguity relationship.

As of the slated release of version 0.5, filter_prd() is a shortcut for add_contiguity() and/or add_cow_majors() if the function is executed in the absence of the data needed to create politically relevant dyads. See the example below for what this means.

References

Weede, Erich. 1976. "Overwhelming preponderance as a pacifying condition among contiguous Asian dyads." Journal of Conflict Resolution 20: 395-411.

Lemke, Douglas and William Reed. 2001. "The Relevance of Politically Relevant Dyads." Journal of Conflict Resolution 45(1): 126-144.

Author

Steven V. Miller

Examples

# \donttest{ # just call `library(tidyverse)` at the top of the your script library(magrittr) A <- cow_ddy %>% add_contiguity() %>% add_cow_majors() %>% filter_prd()
#> Joining, by = c("ccode1", "ccode2", "year")
A
#> # A tibble: 246,314 x 7 #> ccode1 ccode2 year conttype cowmaj1 cowmaj2 prd #> <dbl> <dbl> <int> <dbl> <dbl> <dbl> <dbl> #> 1 2 20 1920 1 1 0 1 #> 2 2 20 1921 1 1 0 1 #> 3 2 20 1922 1 1 0 1 #> 4 2 20 1923 1 1 0 1 #> 5 2 20 1924 1 1 0 1 #> 6 2 20 1925 1 1 0 1 #> 7 2 20 1926 1 1 0 1 #> 8 2 20 1927 1 1 0 1 #> 9 2 20 1928 1 1 0 1 #> 10 2 20 1929 1 1 0 1 #> # … with 246,304 more rows
# you can also use it as a shortcut for the other functions required # to calculate politically relevant dyads. B <- cow_ddy %>% filter_prd()
#> Joining, by = c("ccode1", "ccode2", "year")
B
#> # A tibble: 246,314 x 7 #> ccode1 ccode2 year conttype cowmaj1 cowmaj2 prd #> <dbl> <dbl> <int> <dbl> <dbl> <dbl> <dbl> #> 1 2 20 1920 1 1 0 1 #> 2 2 20 1921 1 1 0 1 #> 3 2 20 1922 1 1 0 1 #> 4 2 20 1923 1 1 0 1 #> 5 2 20 1924 1 1 0 1 #> 6 2 20 1925 1 1 0 1 #> 7 2 20 1926 1 1 0 1 #> 8 2 20 1927 1 1 0 1 #> 9 2 20 1928 1 1 0 1 #> 10 2 20 1929 1 1 0 1 #> # … with 246,304 more rows
identical(A,B)
#> [1] TRUE
# }