Code
pacman::p_load(readxl, tidyverse, here)
d <- read_xls(here("./slides/code/Income-and-Democracy-Data-AER-adjustment.xls"),
sheet = 2) %>%
filter(!is.na(lrgdpch), !is.na(polity4)) %>%
arrange(country, year) %>%
group_by(country) %>%
mutate(lag_dem = lag(polity4),
lag_income = lag(lrgdpch)) %>%
ungroup()
# polity4: standardized democracy score (-10 to 10)
summary(d$polity4) Min. 1st Qu. Median Mean 3rd Qu. Max.
0.000 0.150 0.700 0.573 0.950 1.000
Min. 1st Qu. Median Mean 3rd Qu. Max.
6.094 7.297 8.149 8.167 8.960 10.413