How to clean a very untidy data set with Freedom House country ratings, saved in an Excel sheet, which violates many principles of data organization in spreadsheets described in this paper by Karl Broman and Kara Woo, but otherwise is an invaluable source of data on freedom in the world?
Data source: https://freedomhouse.org/content/freedom-world-data-and-resources
The full code used in this post is available here.
I would do this:
Read in the file,
Data Packages Varieties of Democracy (V-Dem): Dedicated package Polyarchy: Semicolon delimited CSV file -> rio Freedom House: Excel file with by-year sheets Polity IV: SPSS file -> rio Democracy Barometer: Excel file with header in top rows -> rio The Standardized World Income Inequality Database (SWIID): Plain CSV file -> rio World Bank’s World Development Indicators: Dedicated package Merging all datasets Writing to file Shortly after writing this post on importing datasets in different formats (CSV, XLS, XLSX, SAV) to R, I got the following comment:
Data Packages Varieties of Democracy (V-Dem): Dedicated package Polyarchy: Semicolon delimited CSV file Freedom House: Excel file with by-year sheets Polity IV: SPSS file Democracy Barometer: Excel file with header in top rows The Standardized World Income Inequality Database (SWIID): Plain CSV file World Bank’s World Development Indicators: Dedicated package Merging all datasets Country graphs Variable graphs Writing to file with Viktoriia Muliavka
Social and political scientists often need to put together datasets of country-level political, economic, and demographic variables with data from different sources.