from PART THREE - FORMATTING AND STORING DATA
Published online by Cambridge University Press: 15 September 2017
In general, when you collect, clean, and format data, you are working with independent files, but most of the time your analytic work needs to combine files from different sources to answer the questions you define in your research design. It is rarely the case that your research question depends on one particular data set or on several files from one source. Integration is the process of combining your data to produce the file you need. The material on storage focuses on how to code for data retrieval, updating, and sharing; topics that go beyond simply saving your files for later use.
Integrating Data
Preparing the Integration: Cleaning the Keys
To be able to integrate different data sets, you need one column that serves as a key to merge the data. Sometimes, you may even need two columns. That key column is the common column in every data set to be integrated. The headers do not have to be the same (no need for that), but the contents do. For example, if you have two data files of cities from different countries, the key could be the city name. If one file has more cities than the other, it is not a problem, as long as the cities that appear on both files are written using the same spelling. For this example, I will combine some known data sets from different sources to show the issues you face when integrating data.
• Human Development Index (HDI)
• Freedom of the World Index (WORLD)
• Economic Freedom Index (ECO)
• Freedom of the Press (PRESS)
• A table with the country names and their ISO and FIPS (CODES) from America's Open Geocode (http://www.opengeocode.org/) database
The unit of analysis is the country; the column with the country names can be used as the key, but I prefer some kind of country code, so the ISO or FIPS codes are the best option to ease the merging. Notice that I will use the official link to the data this time (the ones provided in the previous footnotes) to avoid scrapping (and mistakes in Wikipedia information). Let's start by getting the ISO and FIPS codes.
To save this book to your Kindle, first ensure no-reply@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.
Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.
Find out more about the Kindle Personal Document Service.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.