This gives missing value an explicit factor level, ensuring that they appear in summaries and on plots.
fct_explicit_na(f, na_level = "(Missing)")
f | A factor (or character vector). |
---|---|
na_level | Level to use for missing values. |
#> f1 #> a b c #> 4 2 2#> f2 #> a b c (Missing) #> 4 2 2 3