R: Tidying methods for anova and AOV objects

anova_tidiers {broom} | R Documentation

## Tidying methods for anova and AOV objects

### Description

Tidies the result of an analysis of variance into an ANOVA table. Only a `tidy` method is provided, not an `augment` or `glance` method.

### Usage

    ## S3 method for class 'anova'
    tidy(x, ...)

    ## S3 method for class 'aov'
    tidy(x, ...)

    ## S3 method for class 'aovlist'
    tidy(x, ...)

### Arguments

`x` | An object of class "anova", "aov", or "aovlist"
`...` | extra arguments (not used)

### Details

Note that the "term" column of an ANOVA table can come with leading or trailing whitespace, which this tidying method trims.

### Value

A data.frame with columns

`term` | Term within the model, or "Residuals"
`df` | Degrees of freedom used by this term in the model
`sumsq` | Sum of squares explained by this term
`meansq` | Mean of sum of squares among degrees of freedom
`statistic` | F statistic
`p.value` | P-value from F test

In the case of an `"aovlist"` object, there is also a `stratum` column describing the error stratum

### Examples

    a <- anova(lm(mpg ~ wt + qsec + disp, mtcars))
    tidy(a)

    a <- aov(mpg ~ wt + qsec + disp, mtcars)
    tidy(a)

    al <- aov(mpg ~ wt + qsec + Error(disp / am), mtcars)
    tidy(al)

[Package broom version 0.4.2 Index]