Skip to content

Latest commit

 

History

History
66 lines (42 loc) · 2.52 KB

README.md

File metadata and controls

66 lines (42 loc) · 2.52 KB

ggtukey

ggtukey status badge stability-experimental

Introduction

This package provides a simple way to visualize paired comparisons by adding compact letter displays (i.e. "Tukey letters") to 'ggplot2' figures.

Installation

It is currently recommended to install ggtukey from GitHub:

install.packages("devtools")
devtools::install_github("https://github.com/ethanbass/ggtukey/")

or from R Universe:

install.packages("ggtukey", repos="https://ethanbass.r-universe.dev/", type="source")

Usage

ggtukey provides a new geom (geom_tukey) for overlaying compact letter displays (CLDs) on ggplot figures.

library(ggtukey)
library(ggplot2)
data <- data.frame("Category" = c(rep("Low", 10), rep("Medium", 10), rep("High", 10)),
                   "Value" = c(rnorm(10, 5), rnorm(10, 5.5), rnorm(10, 10)),
                   "Size" = c("Big","Small"))
                   
ggplot(data, aes(x=Category,y=Value)) + 
  geom_boxplot() + 
  facet_wrap(~Size) +
  geom_tukey(hjust=-0.2,vjust=-0.2)

There is also a convenience function (boxplot_letters) for quickly producing these types of figures as shown below.

boxplot_letters(data, x=Category, y=Value, group=Size)

For more examples and details on different options for customization, please consult the package documentation and vignette.

Citation

You can cite ggtukey as follows:

Bass, E. (2022). ggtukey: Compact Letter Displays for 'ggplot2' (v0.4.0). (https://ethanbass.github.io/ggtukey/).

Further Reading

Piepho, Hans-Peter. An Algorithm for a Letter-Based Representation of All-Pairwise Comparisons. Journal of Computational and Graphical Statistics 13, no. 2 (June 1, 2004): 456–66. https://doi.org/10.1198/1061860043515.

Piepho, Hans-Peter. “Letters in Mean Comparisons: What They Do and Don’t Mean.” Agronomy Journal 110, no. 2 (2018): 431–34. https://doi.org/10.2134/agronj2017.10.0580.

Graves S, Piepho H, Dorai-Raj LSwhfS (2019). multcompView: Visualizations of Paired Comparisons. R package version 0.1-8. https://CRAN.R-project.org/package=multcompView.