Combining multiple datasets, whether by stacking or joining, is commonly necessary as is changing the shape of data. The
reshape2 packages offer good functions for accomplishing this in addition to base tools such as
Manipulating data takes a great deal of effort before serious analysis can begin. In this chapter, I consider when the data need to be rearranged from column-oriented to row-oriented (or the opposite) and when the data are in multiple, separate sets and need to be combined into one.
There are base functions to accomplish these tasks, but I focus on those in
While the tools covered in this chapter still form the backbone of data reshaping, newer packages like
dplyr are starting to supersede them.