R Data Frames

What is a Data Frame:

  • A collection of Columns
  • Displayed in a format as a table. It is a very much like a spreadsheet or a sql table.
  • Data Frames can have different data types, however, each column must have the same data type.
  • The rows have a set of values that match each column.
  • The default way of interacting with data.

Why Are Data Frames Used

  • Used to summarize data
  • Put data into a format that is easy to read and use

Rules for Data Frames

  • Columns should be named. Empty column names could create problems for your results later on on the analysis process.
  • Data stored in the data frames can be of different types such as numeric, logical, character, etc
  • Each column should contain the same number of data items, even if some of that data is missing.


  • Tibbles are data frames
  • Tibbles have the same data types
  • Tibbles never change the names of variables
  • Tibbles never create row names
  • Easy to print in R as they only print the first 10 rows.

Tidy Data

  • Variables are organized into columns
  • Observations are organized into rows.
  • Each value must have its own cell.

How to Create Data Frame

Use the data.frame() function to create data frames.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top