Factors and how to create them
Working with factors
Modifying factor variables
19. Collapsing levels to "Other", part 2


We can also use fct_lump() to show the levels that occur least – we just include a minus (-) in the n argument, like so:

fct_lump(survey$primary_language, n = -5)

If we wanted to find how often the five least-common languages occur in the survey dataset, we'd code:

fct_lump(survey$primary_language, n = -5) %>%

Notice the pipe operator and the fct_count() function!


Use fct_lump(), fct_count(), and the pipe operator to find the five least-common employment situations. Use employment_status in survey.

Stuck? Here's a hint!


fct_lump(survey$employment_status, n = -5) %>% fct_count()