I am trying to find a less convoluted way to extract data from an aov
object. Suppose I have a dataset a
as shown below, and I ran an ANOVA based on the data, resulting in an object named a.model
. I tried to locate the data by using str(a.model)
, but haven't been able to find them. Since I know how to extract data from lm
objects, what I did was using lm(a.model)$model$score
, which works. But is it possible to directly extract data from a.model
without first converting an aov
object to an lm
object? - I guess this is more out of curiosity than anything because the "extra" step of conversion is not that much more work.
a=data.frame(factor1 = rep(letters[1:2], each=10),
factor2 = rep(letters[c(1,2,1,2)], each=5),
score=sort(rlnorm(20)))
a.model = aov(score~factor1*factor2, data=a)