title: Why does pool function in r give "Error: $ operator is invalid for atomic vectors" error?
body: <p>My first question on Stackoverflow...sorry for any inconvenience and imprecision.
  I'm performing an analysis on multiple imputated dataset, generated with <code>mice</code> package.
  I used <code>split</code> function to generate the data.frame list and, on each data.frame, I added an IPTW variable estimated on each data.frame separately.
  With my data ready, I performed the models of interest (weighted Cox models with <code>cph</code> function) and put the results in a list (fit0).
  When I try to run</p>
  <p><code>pool(fit0)</code></p>
  <p>I get the message:</p>
  <pre><code>Error: $ operator is invalid for atomic vectors
  </code></pre>
  <p>I looked into <code>pool</code> function and I find the problem could be in <code>pool.fitlist</code> subfunction. At the beginning of the <code>pool.fitlist</code>, there's a <code>summary</code> that only want extract the coefficients of the models from my list, but if I try to run it out of the function (after a <code>as.mira</code> transformation of my list of results) I get again the error message:</p>
  <pre><code>Error: $ operator is invalid for atomic vectors
  </code></pre>
  <p>Looking to my results, I found that</p>
  <pre><code>&gt; is.atomic(fit0$analyses[[2]]$coefficients)
  [1] TRUE
  </code></pre>
  <p>Any idea how to solve this little drawback?</p>
  <p>EDIT: I add the code and the fake data of example. Initially I create 4 short data.frame and put them in a <code>list</code></p>
  <pre><code>n &lt;- 6
  d1 &lt;- data.frame(id=1:n, 
                   event=c(0,1,1,1,1,1),
                   time=c(19.67, 11.94, 7.86, 1.58, 48.55, 36.18),
                   age=c(59,75,38,67,68,41),
                   drug=c(&quot;Yes&quot;,&quot;No&quot;,&quot;Yes&quot;,&quot;Yes&quot;,&quot;Yes&quot;,&quot;Yes&quot;),
                   w=c(0.07229, 0.52002, 0.04708, 0.06576, 0.08355, 0.04033)
  )
  d2 &lt;- data.frame(id=1:n, 
                   event=c(0,1,1,1,1,1),
                   time=c(19.67, 11.94, 7.86, 1.58, 48.55, 36.18),
                   age=c(59,75,38,67,68,41),
                   drug=c(&quot;Yes&quot;,&quot;No&quot;,&quot;Yes&quot;,&quot;Yes&quot;,&quot;Yes&quot;,&quot;Yes&quot;),
                   w=c(0.0687, 0.5395, 0.0289, 0.1070, 0.1536, 0.1178)
  )
  
  d3 &lt;- data.frame(id=1:n, 
                   event=c(0,1,1,1,1,1),
                   time=c(19.67, 11.94, 7.86, 1.58, 48.55, 36.18),
                   age=c(59,75,38,67,68,41),
                   drug=c(&quot;Yes&quot;,&quot;No&quot;,&quot;Yes&quot;,&quot;Yes&quot;,&quot;Yes&quot;,&quot;Yes&quot;),
                   w=c(0.01654, 0.44411, 0.06588, 0.07772, 0.05326, 0.03234)
  )
  d4 &lt;- data.frame(id=1:n, 
                   event=c(0,1,1,1,1,1),
                   time=c(19.67, 11.94, 7.86, 1.58, 48.55, 36.18),
                   age=c(59,75,38,67,68,41),
                   drug=c(&quot;Yes&quot;,&quot;No&quot;,&quot;Yes&quot;,&quot;Yes&quot;,&quot;Yes&quot;,&quot;Yes&quot;),
                   w=c(0.02490, 1.00000, 0.21502, 0.08058, 0.11399, 0.07635)
  )
  
  ld &lt;- list(d1,d2,d3,d4)
  </code></pre>
  <p>After than I generate preform the IPTW models and gather the results in a list and use the <code>pool</code> function:</p>
  <pre><code>modelFit0 &lt;- vector(&quot;list&quot;, 4)
  
  for(i in 1:4) {
    
    res &lt;- cph(Surv(time,event)~ rcs(age,3) + drug,
                data=ld[[i]], weights=w)
    modelFit0[[i]] &lt;-res
  
  }  
  
  pool.fit.OS &lt;- pool(modelFit0)
  </code></pre>
  <p>Here is where I get:</p>
  <pre><code>&gt; pool.fit.OS &lt;- pool(modelFit0)
  Error: $ operator is invalid for atomic vectors
  In addition: Warning message:
  In get.dfcom(object, dfcom) : Infinite sample size assumed.
  </code></pre>
  <p>Hope this is a valide reproducible example.</p>
  <p>I use <code>cph</code> packeage from <code>rms</code> library.
  These are my sessionInfo:<br />
  R version 4.1.2 (2021-11-01)<br />
  Platform: x86_64-w64-mingw32/x64 (64-bit)<br />
  Running under: Windows 10 x64 (build 19043)<br />
  other attached packages: rms_6.2-0 [...]</p>