I’m trying to select only one data frame, after performing an imputation with aregImpute
and impute.transcan
. However, I cannot get back a variable that was kept out of the imputation model. Can somebody tell me how to do it?
If we illustrate this problem using the following reproducible example, how could I get the dataframe with all the variables that were not imputated, such as Species
and id
variables?
data("iris")
library(missForest)
library(tidyverse)
library(Hmisc)
# example
iris.missing <- iris %>%
group_by(Species) %>%
prodNA(noNA = 0.1) %>%
ungroup() %>%
mutate(id = row_number())
imputation_model <- aregImpute(~ Sepal.Length + Sepal.Width + Petal.Width,
n.impute = 3, data = iris.missing,
pr = FALSE, type = 'pmm')
data_imp <- impute.transcan(imputation_model,
imputation = 1,
data = iris.missing,
list.out = TRUE,
pr = FALSE,
check = FALSE)
datos_imp <- bind_rows(data_imp)