[R] Extracting F and p from aov() - tricksy solution

Mark Myatt mark at myatt.demon.co.uk
Wed May 23 12:36:58 CEST 2001


Peter,

To this clumsy effort:

>> data(warpbreaks)
>> LZ.aov <- summary(aov(breaks ~ wool + tension, data = warpbreaks))
>> LZ.aov.fp <- cbind(LZ.aov[[1]]$"F value", LZ.aov[[1]]$"Pr(>F)")
>> colnames(LZ.aov.fp) <- c("F", "p")
>> 
>> All we need now is to get the right row-names. I suppose that will
>> require a function that will extract the variable names from the
>> formula.

You added:

>Ummm,
>
>> as.matrix(LZ.aov[[1]][4:5])
>             F value      Pr(>F)
>wool        3.339316 0.073613669
>tension     7.536651 0.001377778
>Residuals         NA          NA
>
>(or as.data.frame(), or just use LZ.aov[[1]][4:5] and ignore the
>significance stars...)

Yes, that is much better. Thanks.

Mark

--
Mark Myatt


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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