find_missing is a function that identifies which rows have missing covariate values and which covariates are missing from any row.

find_missing(data, models = NULL, covariates = NULL, ...)

Arguments

data

Source data

models

A model_specification object. If passed, the function will find missingness for all variables in all specified models.

covariates

Variables to check for missingness. If a model specification object is passed, this parameter is ignored.

...

Optional arguments to find_missing (not currently used).

Value

A named list with class missingness with entries containing information about the rows and columns with missingness. Each of the entries is with respect to a set of covariates that are determined either by the set of columns in data that are included in at least one of the models in models or by the value of covariates (models takes precedence if both are provided). The elements in the return value are the following:

  • missing_covs: a character vector of the covariates with missing values in them

  • missing_indicator: a numeric vector of 0s and 1s of length given by the number of rows in data. A value of 0 in the k-th element indicates that none of the k-th values in any of the covariates are missing, while a value of 1 in the k-th element indicates that the k-th value for at least one of the covariates is missing

  • missing_data: a logical matrix with dimensions n * q where n is the number of rows in data and q is the number of covariates under consideration. Each column in the matrix is the result that would be obtained by invoking is.na on the column with the same name from the object that was provided as the input to the data argument

Author

Alexander Breskin