Why factors represent categorical data
📖 Scenario: Imagine you are organizing a small survey about favorite fruits. You want to store the answers in a way that clearly shows the choices are categories, not numbers.
🎯 Goal: You will create a factor in R to represent categorical data and see how R treats it differently from normal text data.
📋 What You'll Learn
Create a character vector with fruit names
Convert the character vector to a factor
Check the structure of the factor
Print the factor to see its levels
💡 Why This Matters
🌍 Real World
Factors are used in surveys, experiments, and any data where values belong to fixed groups like colors, brands, or types.
💼 Career
Understanding factors is important for data analysis and statistics jobs where categorical data is common.
Progress0 / 4 steps