title: Using summary(glm-object) inside ldply() with the summarise() - function
body: <p>How do i use the summary-function inside a ldply()-summarise-function to extract p-values?</p>
  
  <p><strong>Example data:</strong></p>
  
  <p>(The data frame "Puromycin" is preinstalled)</p>
  
  <pre><code>library(reshape2)
  library(plyr)
  Puromycin.m &lt;- melt( Puromycin , id=c("state")  )
  Puro.models &lt;-  dlply( Puromycin.m , .(variable)  , glm , formula =  state ~ value  , 
  family = binomial  )  
  </code></pre>
  
  <p><strong>I can construct this data frame with extracted results:</strong></p>
  
  <pre><code>ldply( Puro.models  ,  summarise ,  "n in each model" = length(fitted.values) ,   
  "Coefficients" = coefficients[2] )
  </code></pre>
  
  <p><strong>But i cant extract the p-values in the same way. I thougt this would work but it does not:</strong></p>
  
  <pre><code>    ldply( Puro.models  ,  summarise ,  
      "n in each model" = length(fitted.values) , 
      "Coefficients" = coefficients[2], 
      "P-value" = function(x) summary(x)$coef[2,4]              )
  </code></pre>
  
  <p><strong>How can i extract p-values to that data frame :) Please help!</strong></p>