midR
What are factors in R?
Updated May 24, 2026
Short answer
Factors represent categorical variables.
Deep explanation
They store categories as levels internally.
Real-world example
Gender or region classification.
Common mistakes
- Treating factors as strings.
Follow-up questions
- What are levels?
- How to convert factor to character?