Add rectangular flags to graphs with ggimage package in R

This quick function can add rectangular flags to graphs. Click here to add circular flags with the ggflags package. The data comes from a Wikipedia table on a recent report by OECD’s Overseas Development Aid (ODA) from donor countries in 2019. Click here to read about scraping tables from Wikipedia with the rvest package in R. In order to use the geom_flag() function, we need … Continue reading Add rectangular flags to graphs with ggimage package in R

Scrape NATO defense expenditure data from Wikipedia with the rvest package in R

We can all agree that Wikipedia is often our go-to site when we want to get information quick. When we’re doing IR or Poli Sci reesarch, Wikipedia will most likely have the most up-to-date data compared to other databases on the web that can quickly become out of date. So in R, we can scrape a table from Wikipedia and turn into a database with … Continue reading Scrape NATO defense expenditure data from Wikipedia with the rvest package in R

Download WorldBank data with WDI package in R

Use this package to really quickly access all the indicators from the World Bank website. With the WDIsearch() function we can look for the World Bank indicator that measures oil rents as a percentage of a country’s GDP. You can look at the World Bank website and browse all the indicators available. The output is: Copy the indicator string and paste it into the WDI() … Continue reading Download WorldBank data with WDI package in R

Visualise panel data regression with ExPanDaR package in R

The ExPand package is an example of a shiny app. What is a shiny app, you ask? Click to look at a quick Youtube explainer. It’s basically a handy GUI for R. When we feed a panel data.frame into the ExPanD() function, a new screen pops up from R IDE (in my case, RStudio) and we can interactively toggle with various options and settings to … Continue reading Visualise panel data regression with ExPanDaR package in R