Skip to content

Instantly share code, notes, and snippets.

View svmiller's full-sized avatar
🤷‍♂️
¯\_(ツ)_/¯

Steven V. Miller svmiller

🤷‍♂️
¯\_(ツ)_/¯
View GitHub Profile
@svmiller
svmiller / tidy-freedom-of-the-press-data.R
Created May 22, 2017 19:13
Not the most elegant, albeit still fairly "tidy" script to make Freedom House's "Freedom of the Press" data actually usable.
library(tidyverse)
library(stringr)
# Freedom of the Press data ---------
# Oh god, Freedom House, why the sam hell do you do these things...
FP <- readxl::read_excel("~/Dropbox/data/freedom-house/FOTP1980-FOTP2017_Public-Data.xlsx", sheet=2) %>%
repair_names()
# Ugh, all right. Let's do this...
@svmiller
svmiller / 1-convert-cow-states-to-country-year.R
Last active May 23, 2017 23:42
Convert CoW state data to country-year panel data.
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() %>%