[R] Problems to extract data from anova table

Dennis Murphy djmuser at gmail.com
Sat Aug 6 15:26:23 CEST 2011


It looks like you want

results[[1]]$Df[5]    # residual df
results[[1]]$`Mean Sq`[5]

Untested without a reproducible example.

Dennis

On Sat, Aug 6, 2011 at 3:00 AM, Roberto <rmoscetti at unitus.it> wrote:
> Hi,
> this is my script
>
>> anova <- aov(data ~ Ts*Te*t + Error(R/Ts*Te*t))
>> results <-  summary(anova$Within)
>
> this is results
>
>          Df Sum Sq Mean Sq F value    Pr(>F)
> Ts         2 1232.2  616.11  53.606 3.965e-10 ***
> Ts:Te      4 4889.5 1222.37 106.356 4.075e-16 ***
> Ts:t       4 6472.1 1618.01 140.780 < 2.2e-16 ***
> Ts:Te:t    8 4181.0  522.63  45.473 1.088e-13 ***
> Residuals 27  310.3   11.49
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> I need to extract "Residuals DF" and "Residuals MeanSq" from results
>
>> str(results)
>
> List of 1
>  $ :Classes ‘anova’ and 'data.frame':   5 obs. of  5 variables:
>  ..$ Df     : num [1:5] 2 4 4 8 27
>  ..$ Sum Sq : num [1:5] 1232 4889 6472 4181 310
>  ..$ Mean Sq: num [1:5] 616.1 1222.4 1618 522.6 11.5
>  ..$ F value: num [1:5] 53.6 106.4 140.8 45.5 NA
>  ..$ Pr(>F) : num [1:5] 3.96e-10 4.07e-16 1.14e-17 1.09e-13 NA
>  - attr(*, "class")= chr [1:2] "summary.aov" "listof"
>
> I try to use results$Df or similar, but nothing seem to work
>
> Thanks in advance
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Problems-to-extract-data-from-anova-table-tp3723125p3723125.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list