Data frames are an important type of object in R language. This object is particularly useful in various statistical modeling applications. Basically, Data frames are used to store tabular data in R.

Data frames store data as a sequence of columns. Each column can be of a different data type.

Difference between Matrices and Data Frames

Data frames can store different classes of objects in each column. In matrices, all the elements are of the same type, for example, all integers or all numeric.

Let’s have a look at an example. Say you want to store data of an employee. Each employee will have a name (string), address (string), phone number (integer), and gender (character). We can represent the data as follows:

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy