miss_impute: Impute data using VIM::irmi

View source: R/missing_data.R

miss_imputeR Documentation

Impute data using VIM::irmi

Description

Useful wrapper for VIM's irmi function. Can skip cases without changing case order depending on the number of missing values

Usage

miss_impute(
  data,
  max_na = floor(ncol(data)/2),
  method = "irmi",
  method_args = NULL,
  leave_out = c()
)

Arguments

data

(data.frame) A data.frame.

max_na

(num scalar) The maximum number of missing datapoints per case.

method

rf (missForest) or irmi (VIM)

method_args

Arguments to forward to the imputation call.

leave_out

Names of variables to leave out of the imputation such as ids.

Value

A data frame with missing data imputed for the desired cases.

Examples

df = miss_add_random(iris[-5]) #example data, remove data at random from iris num data
miss_impute(df) #impute missing
miss_impute(df, method = "irmi") #with irmi
#preserves rownames for ease of use
df = data.frame(a = rnorm(5), b = rnorm(5), c = c(1, NA, NA, 1, 4)) %>% set_rownames(letters[1:5])
miss_impute(df)

Deleetdk/kirkegaard documentation built on April 1, 2024, 2:23 a.m.