Last active
May 23, 2017 23:42
-
-
Save svmiller/68c95dbde4d3d2af1aa86f3b8c437ae6 to your computer and use it in GitHub Desktop.
Convert CoW state data to country-year panel data.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
States <- read_csv("~/Dropbox/data/COW/states/states2011.csv") | |
# Create a PDF of state-years. ---------- | |
# States data nominally end in 2011, so let's fudge that. | |
States %>% | |
mutate(endyear = ifelse(endyear == 2011, 2015, endyear)) %>% | |
rowwise() %>% | |
mutate(year = list(seq(styear, endyear))) %>% | |
ungroup() %>% | |
unnest() %>% | |
arrange(ccode, year) %>% | |
select(ccode, year) %>% | |
distinct(ccode, year) -> CYs | |
CYs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment