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)
theme_set(theme_bw())
library(lubridate)
library(DT)
library(scico)
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
data set provides information on the voting history of the United Nations General Assembly. It contains one row for each country/vote pair.un_votes
## # A tibble: 869,937 × 4
## rcid country country_code vote
## <dbl> <chr> <chr> <fct>
## 1 3 United States 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 869,927 more rows
un_roll_calls
data set contains information on each roll call vote of the United Nations General Assembly.un_roll_calls
## # A tibble: 6,202 × 9
## rcid session importantvote date unres amend para short descr
## <int> <dbl> <int> <date> <chr> <int> <int> <chr> <chr>
## 1 3 1 0 1946-01-01 R/1/66 1 0 AMENDME… "TO ADOP…
## 2 4 1 0 1946-01-02 R/1/79 0 0 SECURIT… "TO ADOP…
## 3 5 1 0 1946-01-04 R/1/98 0 0 VOTING … "TO ADOP…
## 4 6 1 0 1946-01-04 R/1/107 0 0 DECLARA… "TO ADOP…
## 5 7 1 0 1946-01-02 R/1/295 1 0 GENERAL… "TO ADOP…
## 6 8 1 0 1946-01-05 R/1/297 1 0 ECOSOC … "TO ADOP…
## 7 9 1 0 1946-02-05 R/1/329 0 0 POST-WA… "TO OPEN…
## 8 10 1 0 1946-02-05 R/1/361 1 1 U.N. ME… "TO ADOP…
## 9 11 1 0 1946-02-05 R/1/376 0 0 TRUSTEE… "TO ADOP…
## 10 12 1 0 1946-02-06 R/1/394 1 1 COUNCIL… "TO ADOP…
## # … with 6,192 more rows
un_roll_call_issues
data set contains issue classifications of roll call votes of the United Nations General Assembly.un_roll_call_issues
## # A tibble: 5,745 × 3
## rcid short_name issue
## <int> <chr> <fct>
## 1 77 me Palestinian conflict
## 2 9001 me Palestinian conflict
## 3 9002 me Palestinian conflict
## 4 9003 me Palestinian conflict
## 5 9004 me Palestinian conflict
## 6 9005 me Palestinian conflict
## 7 9006 me Palestinian conflict
## 8 128 me Palestinian conflict
## 9 129 me Palestinian conflict
## 10 130 me Palestinian conflict
## # … with 5,735 more rows
There are many votes that have no issue classification, and some are classified under more than one issue.
un_roll_call_issues %>% filter(rcid == 3)
## # A tibble: 0 × 3
## # … with 3 variables: rcid <int>, short_name <chr>, issue <fct>
un_roll_call_issues %>% filter(rcid == 6)
## # A tibble: 1 × 3
## rcid short_name issue
## <int> <chr> <fct>
## 1 6 hr Human rights
un_roll_call_issues %>% filter(rcid == 11)
## # A tibble: 2 × 3
## rcid short_name issue
## <int> <chr> <fct>
## 1 11 co Colonialism
## 2 11 ec Economic development
We begin by looking at how often each country voted “yes” on a resolution in each year. We’ll visualize the results focusing on permanent members of the UN Security Council.
country_list <- c("United States", "Russia", "United Kingdom", "France", "China")
un_votes %>%
filter(country %in% country_list) %>%
inner_join(un_roll_calls, by = "rcid") %>%
group_by(year = year(date), country) %>%
summarize(percent_yes = mean(vote == "yes")) %>%
ggplot(mapping = aes(x = year, y = percent_yes, color = country)) +
geom_line() +
ylab("% of votes that are 'Yes'") +
scale_color_scico_d()
Next, let’s see how the voting records have changed over the years on each of the issues.
un_votes %>%
filter(country %in% country_list) %>%
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) +
scale_color_scico_d()
Consider the plot from Part 1. Describe how the voting behaviors of the five countries have changed over time.
Consider the plot from Part 2.
Below is a list of countries in the data set:
un_votes %>%
arrange(country) %>%
select(country) %>%
distinct() %>%
datatable()