As promised, I am now introducing the most important data structures in R. When you analyze the data, you analyze a dataset. A dataset looks like a SQL Server table: you can observe rows and columns. However, this is not a table in the relational sense, as defined in the Relational Model, which SQL Server follows. The order of rows and columns is not defined in a table that conforms to the Relational Model. However, in R, positions of cells as crossings of rows and columns are known. This is more like a matrix in mathematics.
In the R dataset, rows are also called cases or observations. You analyze the cases by using the values in their columns, also called variables or attributes of the cases.Â
I will introduce the following data structures in this section:
- Matrices and arrays
- Factors
- Lists
- Data frames
A matrix is...