Yes, both matrix and data.frame are multidimensional data-types and both of them store data in rectangular format.
This is where the difference comes:
A 'matrix' stores only homogenous data while a 'data.frame' stores heterogenous data.
Let me demonstrate this with an example:
Matrix:
temperature<-c(20,22,20,25,20)
humidity<-c(54,50,45,43,50)
climate<-matrix(c(temperature,humidity),nrow=5)
climate
[,1] [,2]
[1,] 20 54
[2,] 22 50
[3,] 20 45
[4,] 25 43
[5,] 20 50
This 'climate' matrix takes only numeric vectors and hence it is homogenous.
Data-Frame:
rain<-c(T,F,F,F,T)
rainfall<-data.frame(temp=temperature,humid=humidity,rain=rain)
rainfall
temp humid rain
1 20 54 TRUE
2 22 50 FALSE
3 20 45 FALSE
4 25 43 FALSE
5 20 50 TRUE
'rainfall' is a data.frame which consists of heterogenous entries.