On Aug 6, 2011, at 6:00 AM, Roberto 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

You first need to access the list element, then extract the Df and MeanSq vectors.

results[[1]]$Df and results[[1]]$MeanSq would be the vectors

I don't think they are named vectors, at least judging from what I see working with the example on the ?aov page (and also looking at str() above), so you need to use your object specific knowledge that they are the 5th items of each:

results[[1]]$Df[5] and results[[1]]$MeanSq[5]

If you were doing this programmatically I suppose you could index those vectors with

NROW( results[[1]])

--
David.
______________________________________________
R-help@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.

David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@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.

Reply via email to