factor_NA2missing: Factor NA to "missing" level

View source: R/utils.R

factor_NA2missingR Documentation

Factor NA to "missing" level

Description

Set NA values of a factor vector to a new level indicating missingness

Usage

factor_NA2missing(x, na_level_name = "missing")

Arguments

x

Factor.

na_level_name

Character: Name of new level to create that will be assigned to all current NA values in x.

Value

factor.

Author(s)

EDG

Examples

## Not run: 
x <- factor(sample(letters[1:3], 100, TRUE))
x[sample(1:100, 10)] <- NA
xm <- factor_NA2missing(x)

## End(Not run)

egenn/rtemis documentation built on June 14, 2025, 11:54 p.m.