Factor (R)

A factor is R's type for categorical data. It stores values as a set of discrete levels (categories) rather than plain text, which is essential for grouping…