title: Combine imputed data by group in r using mice
body: <p>my question is a follow-up to this question on imputation by group using "mice":
  <a href="https://stackoverflow.com/questions/48770037/multiple-imputation-and-multigroup-sem-in-r">multiple imputation and multigroup SEM in R</a></p>
  
  <p>The code in the answer works fine as far as the imputation part goes. But afterwards I am left with a list of actually complete data but more than one set. The sample looks as follows:</p>
  
  <pre><code>'Set up data frame'
  df.g1&lt;-data.frame(ID=rep("A",5),x1=floor(runif(5,0,2)),x2=floor(runif(5,10,20)),x3=floor(runif(5,100,150)))
  df.g2&lt;-data.frame(ID=rep("B",5),x1=floor(runif(5,0,2)),x2=floor(runif(5,25,50)),x3=floor(runif(5,200,250)))
  df.g3&lt;-data.frame(ID=rep("C",5),x1=floor(runif(5,4,5)),x2=floor(runif(5,75,99)),x3=floor(runif(5,500,550)))
  df&lt;-rbind(df.g1,df.g2,df.g3)
  
  'Introduce NAs'
  
  df$x1[rbinom(15,1,0.1)==1]&lt;-NA
  df$x2[rbinom(15,1,0.1)==1]&lt;-NA
  df$x3[rbinom(15,1,0.1)==1]&lt;-NA
  df
  
  'Impute values by group:'
  
  df.clean&lt;-lapply(split(df,df$ID), function(x) mice::complete(mice(df,m=5)))
  df.clean
  </code></pre>
  
  <p>As you can see, df.clean is a list of 3. One element per group. But each element containing a complete data set I am looking for. </p>
  
  <p>The original answer suggests to rbind() the obtained data in df.clean which leaves me with a new data set with 45 (3x the original size) observations. 
  Here is the original code for the last step:</p>
  
  <pre><code>imputed.both &lt;- do.call(args = df.clean, what = rbind)
  </code></pre>
  
  <p>Which data is the "right" one? And why the last step?</p>
  
  <p>Thanks a bunch!</p>