Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Factors and how to create them
3. What's wrong with factor()?
Working with factors
Modifying factor variables


The factor() function is easy, right? But there is a small problem. Let's create another factor, but with a value that is not specified in its levels. In marital_status_levels, we would write it like this:

mrt_status <- c("married", "separated")
fct_mrt_status <- factor(mrt_status, levels = marital_status_levels)


What will happen to the new value? To see the values, just click the Run and check code button.