R Data Set

R Data Set

📦 R Data Set

In R, a data set is a collection of data (usually in table form) used for analysis, statistics, and visualization.

R comes with many built-in datasets that are perfect for learning and practice.


 1. What is a Data Set in R?

  • A data set is typically stored as a data frame

  • Contains rows (observations) and columns (variables)

  • Used for testing code, analysis, and examples


 2. Built-in Data Sets in R

R provides many preloaded datasets.

List all available datasets:

data()

 3. Famous Built-in Data Sets

🌸 iris Dataset


Contains:

  • Sepal.Length

  • Sepal.Width

  • Petal.Length

  • Petal.Width

  • Species


🚗 mtcars Dataset


Contains car details like:

  • mpg (mileage)

  • cyl (cylinders)

  • hp (horsepower)


🐭 ToothGrowth Dataset

Used in statistics examples


 4. Explore a Data Set



 5. View Data Set



 6. Select Data from Data Set



 7. Create Your Own Data Set


 


 8. Import External Data Sets

CSV file


Excel (needs package)



 9. Save a Data Set



 10. Why Data Sets Matter in R?

✔ Practice data analysis
✔ Test statistical models
✔ Learn plotting & visualization
✔ Real-world problem solving


📌 Summary

  • Data sets store structured data

  • R provides many built-in datasets

  • Usually stored as data frames

  • Easy to explore, analyze, and visualize

You may also like...