Learn R Programming

rcompanion (version 1.4.0)

cldList: Compact letter display for lists of comparisons

Description

Produces a compact letter display (cld) from pairwise comparisons that were summarized in a table of comparisons

Usage

cldList(comparison, p.value, threshold = 0.05, print.comp = FALSE, remove.space = TRUE, remove.equal = TRUE, remove.zero = TRUE, swap.colon = TRUE, swap.vs = FALSE, ...)

Arguments

comparison
A vector of text describing comparisons, with each element in a form similar to "Treat.A - Treat.B = 0". Spaces and "=" and "0" are removed by default
p.value
A vector of p-values corresponding to the comparisons in the comparison argument
threshold
The alpha value. That is, the p-value below which the comparison will be considered significant
print.comp
If TRUE, prints out a data frame of the modified text of the comparisons. Useful for debugging
remove.space
If TRUE, removes spaces from the text of the comparisons
remove.equal
If TRUE, removes "=" from the text of the comparisons
remove.zero
If TRUE, removes "0" from the text of the comparisons
swap.colon
If TRUE, swaps ":" with "-" in the text of the comparisons
swap.vs
If TRUE, swaps "vs" with "-" in the text of the comparisons
...
Additional arguments passed to multcompLetters

Value

A data frame of group names, group separation letters, and monospaced separtions letters

Details

This function relies upon the multcompLetters function in the multcompView package. The text for the comparisons passed to multcompLetters should be in the form "Treat.A-Treat.B". Currently cldList removes spaces, equal signs, and zeros, by default, and so can use text in the form e.g. "Treat.A - Treat.B = 0". It also changes ":" to "-", and so can use text in the form e.g. "Treat.A : Treat.B".

References

http://rcompanion.org/handbook/F_08.html

Examples

Run this code
data(PoohPiglet)
PoohPiglet$Speaker = factor(PoohPiglet$Speaker,
                            levels=c("Pooh", "Tigger", "Piglet"))
library(FSA)
DT = dunnTest(Likert ~ Speaker,
              data=PoohPiglet,
              method="bh")
DT = DT$res
DT
cldList(comparison       = DT$Comparison,
        p.value          = DT$P.adj,
        threshold        = 0.05)

Run the code above in your browser using DataLab