fct_explicit_na_if | R Documentation |
This inserts explicit missing values in a factor based on a condition. Additionally,
existing NA
values will be explicitly converted to given na_level
.
fct_explicit_na_if(x, condition, na_level = "<Missing>")
x |
( |
condition |
( |
na_level |
( |
A modified factor
with inserted and existing NA
converted to na_level
.
forcats::fct_na_value_to_level()
which is used internally.
fct_explicit_na_if(factor(c("a", "b", NA)), c(TRUE, FALSE, FALSE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.