Learn R Programming

Causata (version 4.2-0)

CleanNaFromFactor: Replaces missing values in a factor.

Description

Missing values are replaced with the string "BLANK", or any other string supplied as an input.

Usage

"CleanNaFromFactor"(x, replacement="BLANK", ...)

Arguments

x
A factor that may contain missing values.
replacement
Levels with missing values will be replaced with this string.
...
Unused arguments for other methods.

Value

Returns a factor that matches the input factor except that missing values are replaced.

Examples

Run this code
f <- as.factor(c("a","b","c",NA))
CleanNaFromFactor(f)

Run the code above in your browser using DataLab