Learn R Programming

peacesciencer (version 0.4.0)

add_minimum_distance: Add minimum distance data to a dyad-year or state-year data frame

Description

add_minimum_distance() allows you to add the minimum distance (in kilometers) to a dyad-year or state-year data frame. These estimates are recorded in the cow_mindist and gw_mindist data that come with this package. The data are current as of the end of 2015.

Usage

add_minimum_distance(data, system)

Arguments

data

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

system

a character specifying whether the user wants Correlates of War state-years ("cow") or Gleditsch-Ward ("gw") state-years.

Value

add_minimum_distance() takes a dyad-year or state-year data frame and adds the minimum distance between the first state and the second state (in dyad-year data) or the minimum minimum (sic) distance for a given state in a given year.

Details

The function leans on attributes of the data that are provided by the create_dyadyear() or create_stateyear() function. Make sure that function (or data created by that function) appear at the top of the proverbial pipe.

References

Weidmann, Nils B. and Kristian Skrede Gleditsch. 2010. "Mapping and Measuring Country Shapes: The cshapes Package." The R Journal 2(1): 18-24.

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
# just call `library(tidyverse)` at the top of the your script
library(magrittr)
cow_ddy %>% add_minimum_distance(system="cow")

create_dyadyears(system = "gw") %>% add_minimum_distance(system = "gw")

create_stateyears(system ="gw") %>% add_minimum_distance(system = "gw")
# }
# NOT RUN {

# }

Run the code above in your browser using DataLab