is.naCoarsened: Missing-Value Indicators for Coarsened Factors

View source: R/coarsened.R

is.naCoarsenedR Documentation

Missing-Value Indicators for Coarsened Factors

Description

A coarsened factor, produced by the function coarsened, stores missing values differently from an ordinary factor. If the base R function is.na is applied to a coarsened factor, every element of the result will be FALSE. The function is.naCoarsened is the suitable alternative to is.na for coarsened factors.

Usage

is.naCoarsened(x)

Arguments

x

a coarsened factor

Details

A coarsened factor, produced by the function coarsened, has two types of levels. Base levels represent states of complete information, and coarse levels represent states of incomplete or missing information. Each coarse level maps onto two or more base levels. The last coarse level is NA, which maps onto every base level.

Value

A logical vector of the same length as x, with TRUE indicating that an element of x is NA, and FALSE otherwise.

Author(s)

Joe Schafer Joseph.L.Schafer@census.gov

References

For more information about coarsened factors in the cvam package, see the vignette Understanding Coarsened Factors in cvam.

See Also

cvam, coarsened, baseLevels, dropCoarseLevels

Examples

fac <- factor( c("red", "green", NA, "yellow", "notRed", "green") )
cFac <- coarsened( fac,
   levelsList = list("notRed" = c("green", "yellow")) )
is.naCoarsened(cFac)

cvam documentation built on March 7, 2023, 5:29 p.m.