Improve your visualizations with ggsave in R

When we save our plots and graphs in R, we can use the ggsave() function and specify the type, size and look of the file. We are going to look two features in particular: anti-aliasing lines with the Cairo package and creating transparent backgrounds. Make your graph background transparent First, let’s create a pie chart with a transparent background. The pie chart will show which … Continue reading Improve your visualizations with ggsave in R

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

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