Save up to $499! Grab all Python courses for $49 or all online courses we’ve ever launched for only $169. Only Feb 11-16. Happy Valentine's!
Factors and how to create them
Working with factors
11. Customizing NAs
Modifying factor variables


What's more, we can give the NA level a customized name, like "unknown". We simply add the name as a second argument to the fct_explicit_na() function:

survey$age <- fct_explicit_na(survey$age, "unknown")


Use fct_explicit_na() on mrt_status. Change the default NA level to "unknown". Assign the result to the marital_status variable. Then, use fct_count() to get the number of unknown values.

Stuck? Here's a hint!


marital_status <- fct_explicit_na(survey$mrt_status, "unknown")