Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Factors and how to create them
1. Factors and forcats
Working with factors
Modifying factor variables
Summary

Instruction

In this part, we will learn about factors. Factors are used in R to store categorical variables. Categorical variables have a limited set of possible values, e.g., a factor named seasons can store four possible values: "spring", "summer", "fall", and "winter". Each possible value of a factor is called a level. Factors can be very useful in some situations and not at all useful in others. Things get especially tricky if you are using those base R functions that force all character variables to be factors. However – and as you learned earlier – that's not the case in tidyverse.

We're going to use a package called forcats to work with factors. This is the tidyverse way of making factors easier to handle.

Exercise

Click Next exercise to continue.