NALevel.Rd
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.
NALevel(x, level)
a vector which will be turned into a factor.
the name for the new level
the vector x with the NAs replaced by level
Andri Signorell <[email protected]>
factor, levels
factor
levels
x <- c(LETTERS[1:5], NA) table(NALevel(x, "something else")) #> #> A B C D E #> 1 1 1 1 1 #> something else #> 1