We want to look at the voting history of countries in the United Nations General Assembly using data from package unvotes.

library(unvotes)
library(tidyverse)
library(lubridate)
library(DT)

Data

We will work with three data sets: un_roll_calls, un_roll_call_issues, and un_votes. Each data set contains a variable called rcid, the roll call id, which can be used to join the data sets with one another.

un_votes
## # A tibble: 738,764 x 4
##     rcid country                  country_code vote 
##    <int> <chr>                    <chr>        <fct>
##  1     3 United States of America US           yes  
##  2     3 Canada                   CA           no   
##  3     3 Cuba                     CU           yes  
##  4     3 Haiti                    HT           yes  
##  5     3 Dominican Republic       DO           yes  
##  6     3 Mexico                   MX           yes  
##  7     3 Guatemala                GT           yes  
##  8     3 Honduras                 HN           yes  
##  9     3 El Salvador              SV           yes  
## 10     3 Nicaragua                NI           yes  
## # … with 738,754 more rows
un_roll_calls
## # A tibble: 5,429 x 9
##     rcid session importantvote date       unres  amend  para short  descr  
##    <int>   <dbl>         <dbl> <date>     <chr>  <dbl> <dbl> <chr>  <chr>  
##  1     3       1             0 1946-01-01 R/1/66     1     0 AMEND… TO ADO…
##  2     4       1             0 1946-01-02 R/1/79     0     0 SECUR… TO ADO…
##  3     5       1             0 1946-01-04 R/1/98     0     0 VOTIN… "TO AD…
##  4     6       1             0 1946-01-04 R/1/1…     0     0 DECLA… TO ADO…
##  5     7       1             0 1946-01-02 R/1/2…     1     0 GENER… "TO AD…
##  6     8       1             0 1946-01-05 R/1/2…     1     0 ECOSO… TO ADO…
##  7     9       1             0 1946-02-05 R/1/3…     0     0 POST-… TO OPE…
##  8    10       1             0 1946-02-05 R/1/3…     1     1 U.N. … "TO AD…
##  9    11       1             0 1946-02-05 R/1/3…     0     0 TRUST… TO ADO…
## 10    12       1             0 1946-02-06 R/1/3…     1     1 COUNC… TO ADO…
## # … with 5,419 more rows
un_roll_call_issues
## # A tibble: 5,281 x 3
##     rcid short_name issue               
##    <int> <chr>      <chr>               
##  1  3372 me         Palestinian conflict
##  2  3658 me         Palestinian conflict
##  3  3692 me         Palestinian conflict
##  4  2901 me         Palestinian conflict
##  5  3020 me         Palestinian conflict
##  6  3217 me         Palestinian conflict
##  7  3298 me         Palestinian conflict
##  8  3429 me         Palestinian conflict
##  9  3558 me         Palestinian conflict
## 10  3625 me         Palestinian conflict
## # … with 5,271 more rows

Analysis

Part 1

We begin by looking at how often each country voted “yes” on a resolution in each year. We’ll visualize the results, so let’s pick a few countries of interest and focus our analysis on them.

country_list <- c("United States of America", "Ghana", "Mexico", "France")
un_votes %>%
  filter(country %in% country_list) %>%
  inner_join(un_roll_calls, by = "rcid") %>% 
  group_by(year = year(date), country) %>%
  summarize(votes = n(),
            percent_yes = mean(vote == "yes")) %>%
  ggplot(mapping = aes(x = year, y = percent_yes, color = country)) +
    geom_line() +
    ylab("% of votes that are 'Yes'")

Part 2

Next, let’s see how the voting records in the United States and France have changed over the years on each of the issues.

un_votes %>%
  filter(country %in% c("United States of America", "France")) %>%
  inner_join(un_roll_calls, by = "rcid") %>%
  inner_join(un_roll_call_issues, by = "rcid") %>%
  group_by(country, year = year(date), issue) %>%
  summarize(votes = n(),
            percent_yes = mean(vote == "yes")) %>%
  filter(votes > 5) %>%  # Only use records where there are more than 5 votes
  ggplot(mapping = aes(x = year, y = percent_yes, color = country)) +
    geom_point() +
    geom_smooth(method = "loess", se = FALSE) + 
    ylab("% of votes that are 'Yes'") +
    facet_wrap(~ issue)

Next Steps

  1. Put your name in the author field at the top of the file (in the yaml – we will discuss what this is at a later date). Knit again.

  2. Change the country names in parts 1 and 2 to countries that interest you. The spelling and capitalization must match what’s in the data, so you can use the Appendix to see the correct spelling and capitalization. Knit again.

You have made your first data visualization!

Discussion Questions

  1. Consider the plot in Part 1. Describe how the voting behaviors of the four countries have changed over time.

  2. Consider the plot in Part 2.
    • On which issues have the two countries voted most similarly in recent years?
    • On which issues have they voted most differently in recent years?
    • Has this changed over time?

References

  1. David Robinson (2017). unvotes: United Nations General Assembly Voting Data. R package version 0.2.0. https://CRAN.R-project.org/package=unvotes.
  2. Erik Voeten “Data and Analyses of Voting in the UN General Assembly” Routledge Handbook of International Organization, edited by Bob Reinalda (published May 27, 2013).
  3. This assignment was adapted from UN Votes exercise and the examples presented in the unvotes package vignette.

Appendix

Below is a list of countries in the data set:

un_votes %>% 
  arrange(country) %>% 
  select(country) %>%
  distinct() %>%
  datatable()