Lump together several small groups

  • If you want to lump together small groups to make a simpler table or plot then use fct_lump*(). For example: fct_lump_lofreq() lumps progressively smallest groups categories into ‘Other’:
gss_cat |>
  mutate(relig = fct_lump_lowfreq(relig)) |>
  count(relig)
## # A tibble: 2 × 2
##   relig          n
##   <fct>      <int>
## 1 Protestant 10846
## 2 Other      10637