R/dunn.letters.R
dunn.letters.Rd
Plotting helper function to add letters indicating statistically similar parings.
dunn.letters(levels, x, y, labels, col2 = col2, cex2 = cex2)
The number of groups
a list of x variables
a list of y variables
what text do you want to include
color of the text label
size of label
Helper function to add letters indicating statitcal significance.
Use in combination with dunn.test::dunn.test() and rcompanion::cldList()
if (FALSE) {
library(dunn.test)
library(rcompanion)
set.seed(123)
data=data.frame(group=c(rep("alpha",5),rep("beta",5),rep("delta",5)),value=c(runif(5,max=2),runif(5,min=4,max=10),runif(5,min=12,max=30)))
DT=with(data,dunn.test(value,group))
rslt=toupper(cldList(P.adjusted ~ comparison,data=DT,threshold = 0.05)$Letter)
boxplot(value~group,data,ylim=c(0,40))
dunn.letters(3,1:3,c(2,10,30),rslt,"red",1)
}