NALevel {DescTools} | R Documentation |
Replace NAs in a Factor by a Given Level
Description
In order to replace the NAs in a factor an additional level has to be defined first. This function does this and replaces the NAs by the given level.
Usage
NALevel(x, level)
Arguments
x |
a vector which will be turned into a factor. |
level |
the name for the new level |
Value
the vector x with the NAs replaced by level
Author(s)
Andri Signorell <andri@signorell.net>
See Also
Examples
x <- c(LETTERS[1:5], NA)
table(NALevel(x, "something else"))
[Package DescTools version 0.99.55 Index]