The data this week comes from Freedom House and the United Nations by way of Arthur Cheib.
freedom <- read_csv("freedom.csv") %>%
  mutate(country = case_when(
    country == "Côte d’Ivoire" ~ "Cote d'Ivoire",
    TRUE ~ country
  ))
freedom.csvScore of 7 for CL and PR means fewer liberties / rights
| variable | class | description | 
|---|---|---|
| country | character | Country Name | 
| year | double | Year | 
| CL | double | Civil Liberties 0-7 | 
| PR | double | Political rights 0-7 | 
| Status | character | Status (Free F, Not Free NF, Partially Free PF) | 
| Region_Code | double | UN Region code | 
| Region_Name | character | UN Region Name | 
| is_ldc | double | Is a least developed country (binary 0/1) | 
freedom_chng_PR <- freedom %>%
  group_by(country) %>%
  mutate(CL_chng = lag(CL) - CL, PR_chng = lag(PR) - PR)  %>%
  mutate(max_PR = max(PR_chng, na.rm = TRUE), 
         min_PR = min(PR_chng, na.rm = TRUE)) %>%
  mutate(change = case_when(
    max_PR > 2 ~ "big",
    min_PR < -2 ~ "big",
    TRUE ~ "small"
  )) %>%
  ungroup() 
freedom_chng_PR %>%
  filter(change == "big") %>%
  #group_by(year, PR_chng, Region_Name) %>%
  #summarise(tot_PR = n()) %>%
  ggplot() +
  geom_hline(yintercept = 0, color = "grey") + 
  geom_point(aes(x = year, y = PR_chng, color = Region_Name)) +
  facet_wrap(~ Region_Name) +
  geom_line(aes(x = year, y = PR_chng, 
                color = Region_Name, linetype = country)) +
  scale_y_continuous(breaks= c(-5:5)) +
  ylab("") +
  ggtitle("Change over year in Political Rights, per country")
The trajectory of change in political rights is plotted across time for countries who have a change in political rights of more than 2, faceted by region Note that no country in the Americas had a change in political rights (year over year) of more than 2 in the time frame given.
freedom_chng_CL <- freedom %>%
  group_by(country) %>%
  mutate(CL_chng = lag(CL) - CL, PR_chng = lag(PR) - PR)  %>%
  mutate(max_CL = max(CL_chng, na.rm = TRUE), 
         min_CL = min(CL_chng, na.rm = TRUE)) %>%
  mutate(change = case_when(
    max_CL > 1 ~ "big",
    min_CL < -1 ~ "big",
    TRUE ~ "small"
  )) %>%
  ungroup() 
freedom_chng_CL %>%
  filter(change == "big") %>%
  #group_by(year, PR_chng, Region_Name) %>%
  #summarise(tot_PR = n()) %>%
  ggplot() +
  geom_hline(yintercept = 0, color = "grey") + 
  geom_point(aes(x = year, y = CL_chng, color = Region_Name)) +
  facet_wrap(~ Region_Name) +
  geom_line(aes(x = year, y = CL_chng, 
                color = Region_Name, linetype = country)) +
  scale_y_continuous(breaks= c(-5:5)) +
  ylab("") +
  ggtitle("Change over year in Civil Liberties, per country")
The trajectory of change in civil liberties is plotted across time for countries who have a change in civil liberties of more than 1, faceted by region Note that no country in the Americas had a change in civil liberties (year over year) of more than 1 in the time frame given.
freedom_chng <- freedom %>%
  group_by(country) %>%
  mutate(CL_chng = lag(CL) - CL, PR_chng = lag(PR) - PR) 
freedom_chng %>%
  group_by(year, PR_chng, Region_Name) %>%
  summarise(tot_PR = n()) %>%
  ggplot() +
  #geom_hline(yintercept = 0, color = "black") + 
  geom_point(aes(x = year, y = PR_chng, size = tot_PR, color = Region_Name)) +
  geom_line(data = ~filter(freedom_chng, abs(PR_chng) > 1), 
            mapping = aes(x = year, y = PR_chng,
                          color = country)) +
  facet_wrap( ~ Region_Name) +
  theme(legend.position = "none")
freedom %>%
  filter(year == 2020) %>%
  ggplot(aes(x = Region_Name, fill = Status)) + 
  geom_bar()
freedom %>%
  filter(year == 1995) %>%
  ggplot(aes(x = Region_Name, fill = Status)) + 
  geom_bar()
praise()
## [1] "You are unreal!"