na.indicator: Missing Data Indicator Matrix

View source: R/na.indicator.R

na.indicatorR Documentation

Missing Data Indicator Matrix

Description

This function creates a missing data indicator matrix R that denotes whether values are observed or missing, i.e., r = 1 if a value is observed, and r = 0 if a value is missing.

Usage

na.indicator(..., data = NULL, as.na = NULL, check = TRUE)

Arguments

...

a matrix or data frame with incomplete data, where missing values are coded as NA. Alternatively, an expression indicating the variable names in data e.g., na.indicator(x1, x2, x3, data = dat). Note that the operators ., +, -, ~, :, ::, and ! can also be used to select variables, see 'Details' in the df.subset function.

data

a data frame when specifying one or more variables in the argument .... Note that the argument is NULL when specifying a matrix or data frame for the argument ....

as.na

a numeric vector indicating user-defined missing values, i.e. these values are converted to NA before conducting the analysis.

check

logical: if TRUE (default), argument specification is checked.

Value

Returns a matrix or data frame with r = 1 if a value is observed, and r = 0 if a value is missing.

Author(s)

Takuya Yanagida takuya.yanagida@univie.ac.at

References

Enders, C. K. (2010). Applied missing data analysis. Guilford Press.

Graham, J. W. (2009). Missing data analysis: Making it work in the real world. Annual Review of Psychology, 60, 549-576. https://doi.org/10.1146/annurev.psych.58.110405.085530

van Buuren, S. (2018). Flexible imputation of missing data (2nd ed.). Chapman & Hall.

See Also

as.na, na.as, na.auxiliary, na.coverage, na.descript, na.pattern, na.prop, na.test

Examples

# Example 1a: Create missing data indicator matrix \eqn{R}
na.indicator(airquality)

# Example 1b: Alternative specification using the 'data' argument
na.indicator(., data = airquality)

misty documentation built on June 29, 2024, 9:07 a.m.

Related to na.indicator in misty...