Data Frames

Learning Outcomes

By the end of this tutorial, you will be able to:

  • Describe the characteristics of data frames.
  • Explain important use-cases for data frames, and explain why data frames are the best choice in these situations.
  • Explain how data frames and lists are related.
  • Explain the differences between data frames and matrices.
  • Create new data frames in R.
  • Use list-style and matrix-style indexing to access and modify the elements of a data frame, and explain the different effects of the available selection operators.
  • Explain how recycling works with data frames.

Data frames are one of the most useful data structures in R, at least when it comes to real-world data analysis. A data frame is a two-dimensional, tabular object wherein the columns can contain different types of data (unlike matrices). This structure closely mirrors the layout of rectangular, spreadsheet-style datasets, so data frames are the natural choice for storing and manipulating real-world datasets in most data analytic projects.

Back to top