What is difference between matrix and dataframes?

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.

The simplest way to look at it is -

All columns in a matrix must have the same data type (numeric, character, etc.) and the same length.

A data frame is more general than a matrix, in that different columns can have different modes (numeric, character, factor, etc.). Just like a table in a database or excel sheet.

As traditional data structure matrix is an mxn array with similar data type and data frame contains multiple data types in multiple columns called field.