R Data Frames

What is a Data Frame?

A data frame is a table with rows and columns used to store structured data.

Each column can have a different data type.

Creating a Data Frame

Loading...
Output:

Viewing Data

Loading...
Output:

Accessing Columns

Loading...
Output:

Indexing Rows and Columns

Loading...
Output:

Adding a Column

Loading...
Output:

Modifying Data

Loading...
Output:

Filtering Data

Loading...
Output:

Summary

Loading...
Output:

Structure

Loading...
Output:

Full Example

Loading...
Output:

Why Data Frames are Important

  • Store structured data
  • Used in data analysis
  • Core of R programming
  • Used in visualization and statistics

Common Mistakes

  • Confusing rows and columns
  • Using incorrect indexes
  • Forgetting commas in df[row, column]

Practice

Create a data frame with names and scores, add a new column, and filter the data.

Loading...
Output:

Need Help?

Ask the AI if you need help understanding or want to dive deeper in any topic