This inserts explicit missings in a factor based on a condition. Note that also additional
existing NA
values will be explicitly converted to given na_level
.
Arguments
- x
(
factor
)
the original factor.- condition
(
logical
)
where to insert missings.- na_level
(
string
)
which level to use for missings.
See also
forcats::fct_na_value_to_level()
which is used internally.