This function modifies a factor by turning NA
into an extra level
(so that NA
values are counted in tables, for instance).
This version of addNA
extends the same function provided in R by
allowing to specify a string name for the extra level (see examples).
addNAstr(x, value = "NA", ...)
Adapted from James (https://stackoverflow.com/a/5817181) by Joseph Larmarange <joseph@larmarange.net>
an object of class "factor"
, original missing values being coded as an
extra level named NA
if as.string=FALSE
, "NA"
if
as.string=TRUE
, as specified by as.string
if as.string
is
a string.
addNA
(base).