model_donor | R Documentation |
This function is intended to be used inside of impute_unsupervised()
as
model_fun
.
model_donor(ds, M = is.na(ds), i = NULL, model_arg = NULL)
ds |
The data set to be imputed. Must be a data frame with column names. |
M |
Missing data indicator matrix |
i |
Index for row of |
model_arg |
A list with two named elements (missing elements will be replaced by default values):
|
A "model" for predict_donor()
which is merely a data frame.
predict_donor()
set.seed(123) ds_mis <- data.frame(X = rnorm(10), Y = rnorm(10)) ds_mis[2:4, 1] <- NA ds_mis[4:6, 2] <- NA # default returns only complete rows model_donor(ds_mis) # with partly_complete and knn returned objects depends on i model_donor(ds_mis, i = 2, model_arg = list(selection = "partly_complete_rows") ) model_donor(ds_mis, i = 4, model_arg = list(selection = "partly_complete_rows") ) model_donor(ds_mis, i = 5, model_arg = list(selection = "partly_complete_rows") ) model_donor(ds_mis, i = 5, model_arg = list(selection = "knn_partly_complete_rows", k = 2) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.