na.indicator | R Documentation |
This function creates a missing data indicator matrix R
that denotes whether
values are observed or missing, i.e., r = 0
if a value is observed, and
r = 1
if a value is missing.
na.indicator(..., data = NULL, na = 0, append = TRUE, name = ".i", as.na = NULL,
check = TRUE)
... |
a matrix or data frame with incomplete data, where missing
values are coded as |
data |
a data frame when specifying one or more variables in the
argument |
na |
an integer value specifying the value representing missing values,
i.e., either |
append |
logical: if |
name |
a character string indicating the name suffix of indicator variables
By default, the indicator variables are named with the ending
|
as.na |
a numeric vector indicating user-defined missing values,
i.e. these values are converted to |
check |
logical: if |
Returns a matrix or data frame with r = 1
if a value is observed, and r = 0
if a value is missing.
Takuya Yanagida takuya.yanagida@univie.ac.at
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.
as.na
, na.as
, na.auxiliary
,
na.coverage
, na.descript
, na.pattern
,
na.prop
, na.test
# Example 1a: Create missing data indicator matrix
na.indicator(airquality)
# Example 1b: Alternative specification using the 'data' argument
na.indicator(., data = airquality)
# Example 2: Append missing data indicator matrix to the data frame
na.indicator(., data = airquality)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.