[R] impute.transcan missing original variables

m@icei m@iii@g oii i@iomed@sid@cu m@icei m@iii@g oii i@iomed@sid@cu
Thu Jun 3 19:00:14 CEST 2021


I’m trying to select only one dataframe, 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?
Best !


Data
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=F, 
                               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)


--
Este mensaje le ha llegado mediante el servicio de correo electronico que ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema Nacional de Salud. La persona que envia este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/



More information about the R-help mailing list