ABSTRACT

As a programming language that has its roots in statistical analysis, it is natural that R will have provided sophisticated structures for the storage and manipulation of data. In Chapter 2, we presented some primitive object types that R uses to represent data. In this chapter we study R’s more sophisticated data structures-lists and dataframes-that simplify data representation, manipulation, and analysis. The dataframe is like a matrix but extended to allow for different object modes in different columns, and the list is a general data storage object that can house pretty much any other kind of R object. We also introduce the factor, which is a special kind of variable that is used to represent categorical objects.