View source: R/add_capital_distance.R
add_capital_distance | R Documentation |
add_capital_distance()
allows you to add capital-to-capital
distance to a (dyad-year, state-year) data frame. The distance variable that
emerges (capdist
) is calculated using the "Vincenty" method (i.e. "as the crow
flies") and is expressed in kilometers.
add_capital_distance(data, transsum = "first")
add_cap_dist(...)
data |
a data frame with appropriate peacesciencer attributes |
transsum |
a character vector with one of the following acceptable inputs: "first" ("jan1") or "last" ("dec31"). Determines what to do for a yearly summary in the case of a capital transition. "first" ("jan1") selects the first capital coordinate observed in a given year while "last" ("dec31") selects the last capital coordinate observed in a given year. Default is "first" ("jan1"). See details section for more. |
... |
optional, only to make the shortcut ( |
The function leans on attributes of the data that are provided by one of the
"create" functions in this package (e.g. create_dyadyear()
or create_stateyear()
).
Be advised that "jan1" and "dec31" are alternate specifications for "first" and "last" respectively and exist as kind of a nudge for what you want to conceptualize the inputs for your year to be what is observed at its start or at its end. Obviously, there was no Jan. 1, 1954 or Dec. 31, 1875 for the Republic of Vietnam.
add_capital_distance()
takes a (dyad-year, state-year) data frame and
adds the capital-to-capital distance between the first state and the second
state (in dyad-year data) or the minimum capital-to-capital distance for a
given state in a given year.
Steven V. Miller
# just call `library(tidyverse)` at the top of the your script
library(magrittr)
cow_ddy %>% add_capital_distance()
create_stateyears() %>% add_capital_distance()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.