What is a factor in R, and why is it used for categorical variables?
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: easy
Interview Round: Other
Overview: Asks what a factor is in R and why categorical variables are stored as factors. Tests knowledge of integer codes and levels, how models and summaries treat factors, ordered factors, and the common conversion and subsetting pitfalls.