convert variable to factor in r code example
Example: How to Convert a Factor in R
> directions <- c("North", "East", "South", "South")
> directions.factor <- factor(directions)
> directions.factor
[1] North East South South
Levels: East North South