R Data, Part 2: More Complicated Structures
Samuel E. Buttrey · 2017
This chapter talks about the major structures in R that data handlers need to know about. The most important of these is the data frame, in which, eventually, almost all of the data will be held. A data frame is part matrix, part list, and in order to use data frames most efficiently, data handler needs to be able to think of it in both ways. The chapter encounters matrices in the data cleaning world, since the table() command can produce something that is basically a matrix. There are several functions that help data handlers to examine the data frame. There are essentially three ways to combine data frames: by columns (i.e., combining horizontally); by rows (i.e., stacking vertically); and matching up rows using a key (merging). The chapter further describes these tasks, as well as some other actions to perform on data frames.