Replaces missing values in a factor.

Description

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

Usage

1
2
## S3 method for class 'factor'
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.

Author(s)

Justin Hemann <support@causata.com>

Examples

1
2
f <- as.factor(c("a","b","c",NA))
CleanNaFromFactor(f)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.