Replace NA's in a Factor with a New Level
DESCRIPTION:
Creates an additional level in a new object representing the missing values in
the old object.
USAGE:
na.include(x)
REQUIRED ARGUMENTS:
- x
-
a factor or any object inheriting from
"factor"
.
VALUE:
an object like
x
, but with an additional level,
"NA"
, representing all
the missing values in
x
. If there were no missing values,
x
is returned.
If
x
does not have a levels attribute then
x
is returned unchanged regardless of whether or not there were missing values.
EXAMPLES:
attach(market.frame)
table(reach.out)
N Y 2
919 62 2
table(na.include(reach.out))
N Y 2 NA
919 62 2 17