fct_explicit_na: Make missing values explicit

Description Usage Arguments Examples

Description

This gives missing value an explicit factor level, ensuring that they appear in summaries and on plots.

Usage

1
fct_explicit_na(f, na_level = "(Missing)")

Arguments

f

A factor.

na_level

Level to use for missing values.

Examples

1
2
3
4
5
f1 <- factor(c("a", "a", NA, NA, "a", "b", NA, "c", "a", "c", "b"))
table(f1)

f2 <- fct_explicit_na(f1)
table(f2)


Search within the forcats package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.