Compared to base::droplevels()
, does not drop NA
levels that have values.
Arguments
- f
A factor (or character vector).
- only
A character vector restricting the set of levels to be dropped. If supplied, only levels that have no entries and appear in this vector will be removed.
See also
fct_expand()
to add additional levels to a factor.