Dataframe can contain different type of data but matrix can contain only similar type of data. Here are the different types of data structures in R:
| Matrix | Dataframe |
|---|---|
| Collection of data sets arranged in a two dimensional rectangular organisation. | Stores data tables that contains multiple data types in multiple column called fields. |
| It’s m*n array with similar data type. | It is a list of vector of equal length. It is a generalized form of matrix. |
| It has fixed number of rows and columns. | It has variable number of rows and columns. |
| The data stored in columns can be only of same data type. | The data stored must be numeric, character or factor type. |
| Matrix is homogeneous. | DataFrames is heterogeneous. |
