fct_explicit_na | R Documentation |
This function is deprecated because the terminology is confusing;
please use fct_na_value_to_level()
instead.
This gives missing values 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: this is what |
f1 <- factor(c("a", "a", NA, NA, "a", "b", NA, "c", "a", "c", "b"))
fct_count(f1)
table(f1)
sum(is.na(f1))
# previously
f2 <- fct_explicit_na(f1)
# now
f2 <- fct_na_value_to_level(f1)
fct_count(f2)
table(f2)
sum(is.na(f2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.