CongratulationsĬongratulations, you have made it to the end of this tutorial! Levels:'L' pant.factor' compares whether 'XL' is greater than 'L', which results in TRUE being printed. You can see below code where there are two categorical variables, namely 'Male' and 'Female', also called factor values. Let's see the example of a factor in action. Parameters:factor(v):v can be vector of values. Usage: Categorize the data which have less number of values. For example, the blood type of a human can be A, B, AB, or O. Note: A categorical variable is those variables that take values based on the labels or names. Also, it helps to reduce data redundancy and to save a lot of space in the memory. The primary use of this function can be seen in data analysis and specifically in statistical analysis. The factors are the variable in R, which takes the categorical variable and stores data in levels.