miss_impute | R Documentation |
Useful wrapper for VIM's irmi function. Can skip cases without changing case order depending on the number of missing values
miss_impute(
data,
max_na = floor(ncol(data)/2),
method = "irmi",
method_args = NULL,
leave_out = c()
)
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. |
A data frame with missing data imputed for the desired cases.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.