tukeyStar: ggplot2 boxplots of ANOVA results

View source: R/tukeyStar.R

tukeyStarR Documentation

ggplot2 boxplots of ANOVA results

Description

tukeyStar makes a boxplot of DF that could be analyzed by ANOVA and draws brackets between comparisons found to be significant by a Tukey post-hoc test.

Usage

tukeyStar(
  DF,
  groupColumn,
  valueColumn,
  barsize = 1.5,
  textsize = 8,
  includeN = FALSE,
  returnStats = FALSE
)

Arguments

DF

The input data.frame on which to perform an ANOVA

groupColumn

The column that contains the groups to be compared.

valueColumn

The column that contains the values of interest.

barsize

The size of the bars to display in the graph. Default is 1.5.

textsize

The size of the asterisks or other text to display in the graph. Default is 8.

includeN

Include a label with the number of observations for each group? (TRUE or FALSE)

returnStats

Return the overall p value from the ANOVA and the results from the Tukey post-hoc test? (TRUE or FALSE)

Value

If returnStats is FALSE, then the output will be the ggplot2 style boxplot. If returnStats is TRUE, then the output will be a list of:

Overall_pvalue

The p value for the overall ANOVA

Comparisons

A data.frame of the Tukey post-hoc comparisons

Graph

The boxplot graph

Examples

Chickens <- data.frame(Hen = rep(c("A", "B", "C"), each = 5),
                 ChickWeight = rep(c(rnorm(5, mean = 5, sd = 1),
                                     rnorm(5, mean = 6, sd = 1),
                                     rnorm(5, mean = 4, sd = 1))))

tukeyStar(DF = Chickens, groupColumn = Hen,
          valueColumn = ChickWeight)

tukeyStar(DF = Chickens, groupColumn = Hen,
          valueColumn = ChickWeight, includeN = TRUE)

tukeyStar(DF = Chickens, groupColumn = Hen,
          valueColumn = ChickWeight, returnStats = TRUE)


shirewoman2/LaurasHelpers documentation built on Oct. 22, 2023, 2:07 p.m.