Thanks, a very helpful function! Together with Matt Mollison's addition of the Mauchly-Test for sphericity (see above) this completely saves me running the repeated measures ANOVAs on SPSS again to get the corrected p-values. And it seems to agree well with the comparisons I have made.
I noticed a clear difference in results by this function and a similar test in SPSS (significant vs. non-significant findings). My data contains scores for 17 participants (rows) across three conditions (columns) as input into a one-way ANOVA for repeated measures. What is weird is that the degrees of freedom are completely different, being 2 in SPSS and 5 with this function, as is also the case with the other computed statistics. Which one is right?