Skip to contents

add_lead() allows you to add some data recorded in the LEAD data to your leader-year or leader-dyad-year data.

Usage

add_lead(data, keep)

Arguments

data

a leader-year or leader-dyad-year data frame

keep

an optional parameter, specified as a character vector, about what leader attributes the user wants to return from this function. If keep is not specified, everything from the LEAD data in this package is returned. Otherwise, the function subsets the LEAD data to just what the user wants.

Value

add_lead() takes a leader-year or leader-dyad-year data frame and adds some data recorded in the LEAD data to it. For leader-dyad-year data, suffices of "1" and "2" are added to the data to indicate attributes of the first leader (obsid1) or the second leader (obsid2), respectively.

References

Ellis, Carli Mortenson, Michael C. Horowitz, and Allan C. Stam. 2015. "Introducing the LEAD Data Set." International Interactions 41(4): 718--741.

Author

Steven V. Miller

Examples


# \donttest{
# just call `library(tidyverse)` at the top of the your script
library(magrittr)

create_leaderyears() %>% add_lead()
#> Joining, by = "obsid"
#> # A tibble: 17,686 × 18
#>    obsid    gwcode leader gender  year yrinoffice leaderage leveledu milservice
#>    <chr>     <dbl> <chr>  <chr>  <dbl>      <dbl>     <dbl>    <dbl>      <dbl>
#>  1 USA-1869      2 Grant  M       1869          1        47        2          1
#>  2 USA-1869      2 Grant  M       1870          2        48        2          1
#>  3 USA-1869      2 Grant  M       1871          3        49        2          1
#>  4 USA-1869      2 Grant  M       1872          4        50        2          1
#>  5 USA-1869      2 Grant  M       1873          5        51        2          1
#>  6 USA-1869      2 Grant  M       1874          6        52        2          1
#>  7 USA-1869      2 Grant  M       1875          7        53        2          1
#>  8 USA-1869      2 Grant  M       1876          8        54        2          1
#>  9 USA-1869      2 Grant  M       1877          9        55        2          1
#> 10 USA-1877      2 Hayes  M       1877          1        55        3          1
#> # … with 17,676 more rows, and 9 more variables: combat <dbl>, rebel <dbl>,
#> #   warwin <dbl>, warloss <dbl>, rebelwin <dbl>, rebelloss <dbl>,
#> #   yrsexper <dbl>, physhealth <dbl>, mentalhealth <dbl>

create_leaderyears() %>% add_lead(keep = c("yrsexper"))
#> Joining, by = "obsid"
#> # A tibble: 17,686 × 8
#>    obsid    gwcode leader gender  year yrinoffice leaderage yrsexper
#>    <chr>     <dbl> <chr>  <chr>  <dbl>      <dbl>     <dbl>    <dbl>
#>  1 USA-1869      2 Grant  M       1869          1        47        0
#>  2 USA-1869      2 Grant  M       1870          2        48        0
#>  3 USA-1869      2 Grant  M       1871          3        49        0
#>  4 USA-1869      2 Grant  M       1872          4        50        0
#>  5 USA-1869      2 Grant  M       1873          5        51        0
#>  6 USA-1869      2 Grant  M       1874          6        52        0
#>  7 USA-1869      2 Grant  M       1875          7        53        0
#>  8 USA-1869      2 Grant  M       1876          8        54        0
#>  9 USA-1869      2 Grant  M       1877          9        55        0
#> 10 USA-1877      2 Hayes  M       1877          1        55       12
#> # … with 17,676 more rows
# }