- Machine Learning with R Quick Start Guide
- Iván Pastor Sanz
- 57字
- 2021-06-24 16:01:30
Factor
A vector of strings of a character is known as a factor. It is used to represent categorical data, and may also include the different levels of the categorical variable. Factors are created with the factor command:
r<-c(1,4,7,9,8,1)
r<-factor(r)
r
## [1] 1 4 7 9 8 1
## Levels: 1 4 7 8 9