title: R: tidy() an aovlist-object using the broom package
body: <p>I have had some trouble tidying <code>avolist</code> objects. When performing a repeated measures analysis of variance the optput object is usually a list of <code>aov</code> objects for the different error strata.</p>
  
  <pre><code>datafilename &lt;- "http://personality-project.org/r/datasets/R.appendix5.data"
  aov_example &lt;- read.table(datafilename, header = T)
  aov_example &lt;- aov(Recall ~ (Task*Valence*Gender*Dosage) + Error(Subject/(Task*Valence)) +(Gender*Dosage), aov_example)
  class(aov_example)
  </code></pre>
  
  <blockquote>
    <p>[1] "aovlist" "listof"</p>
  </blockquote>
  
  <p>(example stolen from <a href="http://personality-project.org/r/#anova" rel="nofollow">http://personality-project.org/r/#anova</a>)</p>
  
  <p>To-date, it is not possible to tidy these objects directly because <code>broom::fix_data_frame()</code> doesn't take lists.</p>
  
  <pre><code>library("broom")
  tidy(aov_example)
  </code></pre>
  
  <blockquote>
    <p>Error in as.data.frame.default(x) : 
     cannot coerce class "c("aovlist", "listof")" to a data.frame</p>
  </blockquote>
  
  <p>So I tried to use <code>lapply()</code>, but this throws an error:</p>
  
  <pre><code>lapply(aov_example, tidy)
  </code></pre>
  
  <blockquote>
    <p>Error in `colnames&lt;-`(`*tmp*`, value = c("df", "sumsq", "meansq", "statistic",  : 
     Attribute 'names' [5] must be of same length as vector [3]</p>
  </blockquote>
  
  <p>Is there an easy fix for this?</p>