Make a timeline graph with dates in ggplot2

We will use the geom_segment layer from ggplot2 to make a timeline graph! This layer takes both x and y as well as xend and yend inputs for the start and end of the segment lines in the plot. For our timeline, the x will be the start of each Irish Taoiseach’s term. The xend will be the end of their term, when they get … Continue reading Make a timeline graph with dates in ggplot2

Examining speeches from the UN Security Council Part 1

Let’s look at how many speeches took place at the UN Security Council every year from 1995 until 2019. I want to only look at countries, not organisations. So a quick way to do that is to add a variable to indicate whether the speaker variable has an ISO code. Only countries have ISO codes, so I can use this variable to filter away all … Continue reading Examining speeches from the UN Security Council Part 1

Create a correlation matrix with GGally package in R

We can create very informative correlation matrix graphs with one function. Packages we will need: First, choose some nice hex colors. Next, we can go create a dichotomous factor variable and divide the continuous “freedom from torture scale” variable into either above the median or below the median score. It’s a crude measurement but it serves to highlight trends. Blue means the country enjoys high … Continue reading Create a correlation matrix with GGally package in R