If you want more information or if you just want to review and take a look at a comparison of the five general data structures in R, watch the small video below:Īs you can see, there are different data structures that impose different requirements on how the data is stored. As such, they can actually be seen as special types of lists and can be accessed as either a matrix or a list. However, it’s a list with vector structures of the same length. Maybe you will have already noticed that this data structure ressembles that of matrices, except for the fact that their data values don’t need to be of the same type, while matrices do require this.ĭata frames also have similarities with lists, which are basically collections of components. As such, they are often called categorical variables.ĮyJsYW5ndWFnZSI6InIiLCJzYW1wbGUiOiJoZWFkKHdhcnBicmVha3MpIn0= Remember that factors are variables that can only contain a limited number of different values. In case you’re wondering, this data is about the number of breaks in yarn during weaving :). Each column needs to consist of values of the same type, since they are data vectors: as such, the breaks column only contains numerical values, while the wool and tension columns have characters as values that are stored as factors. Īs you can see below, each instance, listed in the first unnamed column with a number, has certain characteristics that are spread out over the remaining three columns. This means that a data frame’s rows do not need to contain, but can contain, the same type of values: they can be numeric, character, logical, etc. Each row of these grids corresponds to measurements or values of an instance, while each column is a vector containing data for a specific variable.
With the data frame, R offers you a great first step by allowing you to store your data in overviewable, rectangular grids. The Root: What’s An R Data Frame Exactly?