fct_nanify: NAnify factor level

View source: R/factors.R

fct_nanifyR Documentation

NAnify factor level

Description

The inverse of fct_explicit_na(). Turns the level into proper NA. Retains the level.

Usage

fct_nanify(f, level, negate = FALSE, ignore_case = TRUE)

Arguments

f

factor to work on

level

character, regular expression matching the desired level

negate

logical, whether to return non-matching elements. Defaults to FALSE.

ignore_case

logical, ignore case when matching? Defaults to TRUE.

Value

factor with NA-substituted level.

Examples

f <- factor(c("a", "b", "c", "nanify"))
fct_nanify(f, "nanify")


scholaempirica/reschola documentation built on May 14, 2022, 8:38 a.m.