title: r filter and aggregate results from lapply model summary
body: <p>I am trying to filter and aggregate results from multiple regression models executed on a subset of dataset using dlply.</p>
  <p>This is how I ran my models:</p>
  <pre><code>library(plyr)
  
  data(&quot;mtcars&quot;)
  
  models = dlply(mtcars, .(cyl), function(df) lm(mpg ~ hp,data=df))
  lapply(models, summary)
  </code></pre>
  <p>Right now I am combining the results from different models(cylinder 4, 6, 8) like this:</p>
  <pre><code>rbind(
    c(&quot;Cylinder 4&quot;, coef(lapply(models, summary)$`4`)[2,]),
    c(&quot;Cylinder 6&quot;, coef(lapply(models, summary)$`6`)[2,]),
    c(&quot;Cylinder 8&quot;, coef(lapply(models, summary)$`8`)[2,])
  )
  </code></pre>
  <p>Is there a way to summarize this more efficiently?</p>