Add Archigos political leader information to dyad-year and state-year data
Source:R/add_archigos.R
      add_archigos.Rdadd_archigos() allows you to add some information about
leaders to dyad-year or state-year data. The function leans on an abbreviated
version of the data, which also comes in this package.
Value
add_archigos() takes a dyad-year or state-year data frame and
adds a few summary variables based off the leader-level data. These include
whether there was a leader transition in the state-year (or first/second
state in the dyad-year), whether there was an "irregular" leader transition,
the number of leaders in the state-year, the unique leader ID for Jan. 1 of
the year, and the unique leader ID for Dec. 31 of the year.
Details
The function leans on attributes of the data that are provided by
the create_dyadyears() or create_stateyears() function. Make sure
that function (or data created by that function) appear at the top of the
proverbial pipe.
References
Goemans, Henk E., Kristian Skrede Gleditsch, and Giacomo Chiozza. 2009. "Introducing Archigos: A Dataset of Political Leaders" Journal of Peace Research 46(2): 269–83.
Examples
# \donttest{
# just call `library(tidyverse)` at the top of the your script
library(magrittr)
cow_ddy %>% add_archigos()
#> # A tibble: 2,214,930 × 13
#>    ccode1 ccode2  year leadertransition1 irregular1 n_leaders1 jan1obsid1
#>     <dbl>  <dbl> <dbl>             <dbl>      <dbl>      <int> <chr>     
#>  1      2     20  1920                 0          0          1 USA-1913  
#>  2      2     20  1921                 1          0          2 USA-1913  
#>  3      2     20  1922                 0          0          1 USA-1921  
#>  4      2     20  1923                 1          0          2 USA-1921  
#>  5      2     20  1924                 0          0          1 USA-1923  
#>  6      2     20  1925                 0          0          1 USA-1923  
#>  7      2     20  1926                 0          0          1 USA-1923  
#>  8      2     20  1927                 0          0          1 USA-1923  
#>  9      2     20  1928                 0          0          1 USA-1923  
#> 10      2     20  1929                 1          0          2 USA-1923  
#> # ℹ 2,214,920 more rows
#> # ℹ 6 more variables: dec31obsid1 <chr>, leadertransition2 <dbl>,
#> #   irregular2 <dbl>, n_leaders2 <int>, jan1obsid2 <chr>, dec31obsid2 <chr>
create_stateyears() %>% add_archigos()
#> # A tibble: 17,511 × 8
#>    ccode cw_name  year leadertransition irregular n_leaders jan1obsid dec31obsid
#>    <dbl> <chr>   <dbl>            <dbl>     <dbl>     <int> <chr>     <chr>     
#>  1     2 United…  1816               NA        NA        NA NA        NA        
#>  2     2 United…  1817               NA        NA        NA NA        NA        
#>  3     2 United…  1818               NA        NA        NA NA        NA        
#>  4     2 United…  1819               NA        NA        NA NA        NA        
#>  5     2 United…  1820               NA        NA        NA NA        NA        
#>  6     2 United…  1821               NA        NA        NA NA        NA        
#>  7     2 United…  1822               NA        NA        NA NA        NA        
#>  8     2 United…  1823               NA        NA        NA NA        NA        
#>  9     2 United…  1824               NA        NA        NA NA        NA        
#> 10     2 United…  1825               NA        NA        NA NA        NA        
#> # ℹ 17,501 more rows
# }