Solved – How to utilize the result of aov function

anovadata visualizationr

Based on the responses from the question How to draw a side-by-side plot mentioned in "Graphical Display as an Aid to Analysis", I am considering implementing the function myself. The problem is that I don't know how to utilize the result of aov() function. I have to see how many factors there are, the names of factors, what are their main effects and interaction effects, etc. I can get residuals from aov(y~x)$residuals. I consulted the documentation for aov(), but I still have no clue how to do this. There must be some other way much complex than something like t.test(x,y)$p.value.

Would you help me?

Best Answer

The str function will show you the structure of any object, including the results from aov. Some values of interest (such as p-values) are not in the aov object, but in the summary object from summary(aov.object) (run str on that as well). Some statistics will be a column in a matrix (the p-value is a column in the coefficient matrix of the summary object).

The aov object has an additional complexity in that it can be a list of aov objects (due to possible nesting structures, each level of nesting producing an object in the list). You might want to examine the code of other functions that use aov objects to see how they access the parts and what they do with them.