Home

How to recreate Pew opinion graphs with ggplot2 in R

Packages we will need In this blog post, we are going to recreate Pew Opinion poll graphs. This is the plot we will try to recreate on gun control opinions of Americans: To do this, we will download the data from the Pew website by following the link below: We then select the variables related … Continue reading How to recreate Pew opinion graphs with ggplot2 in R

Examining Ireland’s foreign policy in pictures with R

Packages we will need: In January 2015, the Irish government published a review of Ireland’s foreign policy. The document, The Global Island: Ireland’s Foreign Policy for a Changing World offers a perspective on Ireland’s place in the world. In this blog, we will graph out some of the key features of Ireland’ foreign policy and so … Continue reading Examining Ireland’s foreign policy in pictures with R

How to tidy up messy Wikipedia data with dplyr in R

Packages we will need: To see another blog post that focuses on cleaning messy strings and dates, click here to read We are going to look at Irish embassies and missions around the world. Where are the embassies, and which country has the most missions (including embassies, consulates and representational offices)? Let’s first scrape the … Continue reading How to tidy up messy Wikipedia data with dplyr in R

Running tidy t-tests with the infer package in R

Packages we will need: For this t-test, we will compare US millenials and non-millenials and their views of the UK’s influence in the world. The data will come from Chicago Council Survey of American Public Opinion on U.S. Foreign Policy Click here to download 2017 policy survey data The survey investigates American public opinion on … Continue reading Running tidy t-tests with the infer package in R

Check model assumptions with easystats package in R

Packages we will need: Easystats is a collection of R packages, which aims to provide a unifying and consistent framework to tame, discipline, and harness the scary R statistics and their pesky models, according to their github repo. Click here to browse the github and here to go to the specific perfomance package CRAN PDF … Continue reading Check model assumptions with easystats package in R

Comparing North and South Korean UN votes at the General Assembly with unvotes package

Packages we will use Last September 17th 2021 marked the 30th anniversary of the entry of North Korea and South Korea into full membership in the United Nations. Prior to this, they were only afforded observer status. keia.org The Two Koreas Mark 30 Years of UN Membership: The Road to Membership Let’s look at the types … Continue reading Comparing North and South Korean UN votes at the General Assembly with unvotes package

Download and graph UN votes data with the unvotes package in R

Packages we will need: How to download UN votes to R. This package was created by David Robinson. Click here to read the CRAN PDF. We will download both the votes roll calls and the issues. Then we can use the inner_join() variable to add them together by the ID. We can create a year … Continue reading Download and graph UN votes data with the unvotes package in R

Wrangling and graphing UN Secretaries-General data with R

Packages we will need: According to Urquhart (1995) in his article, “Selecting the World’s CEO”, From the outset, the U.N. secretarygeneral has been an important part of theinstitution, not only as its chief executive,but as both symbol and guardian of theoriginal vision of the organization.There, however, specific agreement hasended. The United Nations, like anyimportant organization, … Continue reading Wrangling and graphing UN Secretaries-General data with R

Scraping and wrangling UN peacekeeping data with tidyr package in R

Packages we will need: For this blog post, we will look at UN peacekeeping missions and compare across regions. Despite the criticisms about some operations, the empirical record for UN peacekeeping records has been robust in the academic literature “In short, peacekeeping intervenes in the most difficultcases, dramatically increases the chances that peace willlast, and … Continue reading Scraping and wrangling UN peacekeeping data with tidyr package in R

Convert event-level data to panel-level data with tidyr in R

Packages we will need: In this post, we are going to scrape NATO accession data from Wikipedia and turn it into panel data. This means turning a list of every NATO country and their accession date into a time-series, cross-sectional dataset with information about whether or not a country is a member of NATO in … Continue reading Convert event-level data to panel-level data with tidyr in R

Lump groups together and create “other” category with forcats package

Packages we will need: For this blog, we are going to look at the titles of all countries’ heads of state, such as Kings, Presidents, Emirs, Chairman … understandably, there are many many many ways to title the leader of a country. First, we will download the PACL dataset from the democracyData package. Click here … Continue reading Lump groups together and create “other” category with forcats package

Visualise DemocracyData with graphs and maps

Packages we will need: In this post, we will look at easy ways to graph data from the democracyData package. The two datasets we will look at are the Anckar-Fredriksson dataset of political regimes and Freedom House Scores. Regarding democracies, Anckar and Fredriksson (2018) distinguish between republics and monarchies. Republics can be presidential, semi-presidential, or … Continue reading Visualise DemocracyData with graphs and maps

Download democracy data with democracyData package in R

Packages we will need: This blog will highlight some quick datasets that we can download with this nifty package. To install the democracyData package, it is best to do this via the github of Xavier Marquez: We can download the dataset from the Democracy and Dictatorship Revisited paper by Cheibub Gandhi and Vreeland (2010) with … Continue reading Download democracy data with democracyData package in R

Scrape and graph election polling data from Wikipedia

Packages we will need: With the Korean Presidential elections coming up, I wanted to graph the polling data since the beginning of this year. The data we can use is all collated together on Wikipedia. Click here to read more about using the rvest package for scraping data from websites and click here to read … Continue reading Scrape and graph election polling data from Wikipedia

Exploratory Data Analysis and Descriptive Statistics for Political Science Research in R

Packages we will use: Before jumping into any inferentional statistical analysis, it is helpful for us to get to know our data. For me, that always means plotting and visualising the data and looking at the spread, the mean, distribution and outliers in the dataset. Before we plot anything, a simple package that creates tables … Continue reading Exploratory Data Analysis and Descriptive Statistics for Political Science Research in R

Comparing proportions across time with ggstream in R

Packages we need: We can look at proportions of energy sources across 10 years in Ireland. Data source comes from: https://www.seai.ie/data-and-insights/seai-statistics/monthly-energy-data/electricity/ Before we graph the energy sources, we can tidy up the variable names with the janitor package. We next select column 2 to 12 which looks at the sources for electricity generation. Other rows … Continue reading Comparing proportions across time with ggstream in R

Create density plots with ggridges package in R

Packages we will need: We will plot out the favourability opinion polls for the three main political parties in Ireland from 2016 to 2020. Data comes from Louwerse and Müller (2020) Before we dive into the ggridges plotting, we have a little data cleaning to do. First, we extract the last four “characters” from the … Continue reading Create density plots with ggridges package in R

Comparing mean values across OECD countries with ggplot

Packages we will need: I came across code for this graph by Tanya Shapiro on her github for #TidyTuesday. Her graph compares Dr. Who actors and their average audience rating across their run as the Doctor on the show. So I have very liberally copied her code for my plot on OECD countries. That is … Continue reading Comparing mean values across OECD countries with ggplot

Graphing Pew survey responses with ggplot in R

Packages we will need: We are going to look at a few questions from the 2019 US Pew survey on relations with foreign countries. Data can be found by following this link: We are going to make bar charts to plot out responses to the question asked to American participaints: Should the US cooperate more … Continue reading Graphing Pew survey responses with ggplot in R