Abstract
This chapter explains how to make major changes to the structure of a dataset. You may need to combine data from two or more different sources into one dataset. This may be as simple as attaching one dataset to the bottom or side of another (known as appending or concatenating), or it may involving using a common variable to match the observations (known as merging). Alternatively, you may need to combine the values from several variables into one variable (stacking) or split one variable into several variables (unstacking). Finally, you may need to reshape a dataset so that data that was once held in separate variables in now held in separate observations, or vice versa (also known as rotating or transposing).
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2014 Sarah Stowell
About this chapter
Cite this chapter
Stowell, S. (2014). Combining and Restructuring Datasets. In: Using R for Statistics. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-0139-8_4
Download citation
DOI: https://doi.org/10.1007/978-1-4842-0139-8_4
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-0140-4
Online ISBN: 978-1-4842-0139-8
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)