NALevel | R Documentation |
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)
x |
a vector which will be turned into a factor. |
level |
the name for the new level |
the vector x with the NAs replaced by level
Andri Signorell <andri@signorell.net>
factor
, levels
x <- c(LETTERS[1:5], NA)
table(NALevel(x, "something else"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.