[R] extracting elements from summary(aov object)
Thomas Lumley
tlumley at u.washington.edu
Tue Sep 24 20:34:54 CEST 2002
On Tue, 24 Sep 2002, Bill Shipley wrote:
> Hello. When one types "summary(fit)", where fit is an object from a call
> to aov(), one gets an ANOVA table. I want to save just one element of this
> summary. How does one extract this?
>
> As an example, here is my output from a split plot ANOVA:
>
> > summary(out)$"Error: soil.cores$block:soil.cores$treatment"
> Df Sum Sq Mean Sq F value Pr(>F)
> soil.cores$block 3 0.63626 0.21209 1.0557 0.4147
> soil.cores$treatment 3 0.90276 0.30092 1.4978 0.2802
> Residuals 9 1.80813 0.20090
>
> I want to save only the F value of "soil.cores$treatment" . In SPLUS one
> would do this by
> summary(out)$"Error: soil.cores$block:soil.cores$treatment"$"F value"[2]
> but this doesn't seem to work.
>
It turns out that
summary(out)$"Error: soil.cores$block:soil.cores$treatment"
is actually a list containing one data frame rather than a data frame, so
something like
aovtable<-summary(out)$"Error: soil.cores$block:soil.cores$treatment"[[1]]
aovtable[2,"F value"]
would work.
-thomas
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list