[R] how to extract information from anova results
David Winsemius
dwinsemius at comcast.net
Tue Jul 13 16:54:06 CEST 2010
On Jul 13, 2010, at 10:35 AM, Luis Borda de Agua wrote:
> Hi,
>
> I have used the instruction aov in the following manner:
>
> res <- aov(qwe ~ asd)
>
> when I typed "res" I get:
> _________
> Call:
> aov(formula = qwe ~ asd)
>
> Terms:
> asd Residuals
> Sum of Squares 0.0708704 0.5255957
> Deg. of Freedom 1 8
>
> Residual standard error: 0.2563191
> Estimated effects may be unbalanced
> _________
>
> I need to access the value of the Sum of Squares (i.e. I want
> another variable to be equal to it, e.g myvar <- Sum.of.Squares) .
> I tried names(res) to see which values are accessible, but I
> couldn't find the Sum of Squares. I had a similar problem when I
> tried to access the p.value which can be readily SEEN using
> summary(res).
>
> In general, is there an easy way to access the values generated by
> an R function?
When you typed "res", the interpreter determined that it was of type
"aov" and dispatched it to the print method for objects of that class.
The list of print methods is accessed with:
methods(print) and it's a long list. print.aov is asterisked so you
either need to look at the function with:
getAnywhere(print.aov)
....or perhaps more directly assign summary(res) to an object and
access its SS values.
--
David.
>
>
> Thank you,
>
> LBA
>
> ______________________________________________
> 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.
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list