TukeyHSD.lm: Additional interfaces to TukeyHSD

Description Usage Arguments Examples

View source: R/Tukey.R

Description

TukeyHSD() requires use of aov(). Since this is a hinderence for beginners, wrappers have been provided to remove this need.

Usage

1
2
3
4
5
6
## S3 method for class 'lm'
TukeyHSD(x, which, ordered = FALSE, conf.level = 0.95, ...)

## S3 method for class 'formula'
TukeyHSD(x, which, ordered = FALSE, conf.level = 0.95,
  data = parent.frame(), ...)

Arguments

x

an object, for example of class lm or formula

which, ordered, conf.level, ...

just as in TukeyHSD() from the base package

data

a data frame. NB: This does not come second in the argument list.

Examples

1
2
3
4
5
6
7
## These should all give the same results
if (require(mosaicData)) {
  model <- lm(age ~ substance, data=HELPrct)
  TukeyHSD(model)
  TukeyHSD( age ~ substance, data=HELPrct)
  TukeyHSD(aov(age ~ substance, data=HELPrct))
}

Example output

Loading required package: dplyr

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

    filter, lag

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

Loading required package: lattice
Loading required package: ggformula
Loading required package: ggplot2

New to ggformula?  Try the tutorials: 
	learnr::run_tutorial("introduction", package = "ggformula")
	learnr::run_tutorial("refining", package = "ggformula")
Loading required package: mosaicData
Loading required package: Matrix

The 'mosaic' package masks several functions from core packages in order to add 
additional features.  The original behavior of these functions should not be affected by this.

Note: If you use the Matrix package, be sure to load it BEFORE loading mosaic.

Attaching package: 'mosaic'

The following object is masked from 'package:Matrix':

    mean

The following objects are masked from 'package:dplyr':

    count, do, tally

The following objects are masked from 'package:stats':

    IQR, binom.test, cor, cor.test, cov, fivenum, median, prop.test,
    quantile, sd, t.test, var

The following objects are masked from 'package:base':

    max, mean, min, prod, range, sample, sum

  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = age ~ substance, data = HELPrct)

$substance
                     diff       lwr       upr     p adj
cocaine-alcohol -3.704319 -5.639202 -1.769436 0.0000255
heroin-alcohol  -4.754192 -6.803234 -2.705149 0.0000002
heroin-cocaine  -1.049873 -3.167195  1.067450 0.4741712

mosaic documentation built on May 23, 2018, 9:03 a.m.