R: tidy a TukeyHSD object

tidy.TukeyHSD {broom} | R Documentation

## tidy a TukeyHSD object

### Description

Returns a data.frame with one row for each pairwise comparison

### Usage

    ## S3 method for class 'TukeyHSD'
    tidy(x, separate.levels = FALSE, ...)

### Arguments

`x` | object of class "TukeyHSD"
`separate.levels` | Whether to separate comparison into `level1` and `level2` columns
`...` | additional arguments (not used)

### Value

A data.frame with one row per comparison, containing columns

`term` | Term for which levels are being compared
`comparison` | Levels being compared, separated by -
`estimate` | Estimate of difference
`conf.low` | Low end of confidence interval of difference
`conf.high` | High end of confidence interval of difference
`adj.p.value` | P-value adjusted for multiple comparisons

If `separate.levels = TRUE`, the `comparison` column will be split up into `level1` and `level2`.

### See Also

`TukeyHSD`

### Examples

    fm1 <- aov(breaks ~ wool + tension, data = warpbreaks)
    thsd <- TukeyHSD(fm1, "tension", ordered = TRUE)
    tidy(thsd)
    tidy(thsd, separate.levels = TRUE)

    # may include comparisons on multiple terms
    fm2 <- aov(mpg ~ as.factor(gear) * as.factor(cyl), data = mtcars)
    tidy(TukeyHSD(fm2))

[Package broom version 0.4.4 Index]