在添加紧凑型字母显示时,cldList()函数的行为异常 [英] cldList() function behaves weirdly when adding compact letter display
本文介绍了在添加紧凑型字母显示时,cldList()函数的行为异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我问了一个问题here但现在面临另一个问题
从程序包rcompanion
运行cldList()
后,它给出了一个表格,显示了每个组的紧凑字母显示,但有些组没有显示任何字母,尽管与其他组没有明显差异。
数据太大,我正在上传 here
这是错误还是我做错了什么。
我使用的代码是这个
library(FSA)
library(multcompView)
library(rcompanion)
library(ggplot2)
library(ggpubr)
library(tidyr)
raw_df <- read.csv("raw_data.csv")
#After performing Kruskal-Wallis H test, I found significant groups and performed the post hoc test using dunnTest() using the code below
bells <- dunnTest(Group ~ as.factor(Color_Score), method = "bh", data = raw_df)
#I save the P values into a separate variable
piano <- bells$`res`
#After the Dunn Test, I tried to get the compact letter displays.
flute <- cldList(P.adj ~ Comparison, data = piano, threshold = 0.05)
#This is where the problem starts, overall, I have 40 groups to compare but would only return letters for 38 groups
#I tried plotting the boxplot and adding the compact letter using the code below
ggboxplot(raw_df, x = "Group", y = "Color_Score",
combine = FALSE,
x.text.angle = 360,
orientation = "vertical",
ylab = "Measurement (cm)",
xlab = "Group",
color = "Group",
fill = "Group",
notch = FALSE,
ggtheme = theme_gray()) +
font("xy.text", size = 7, color = "black") +
theme(legend.position = "None",
axis.text.x =element_text(color = "black")) +
color of the y-axis (Measurement) tick labels
geom_text(data = flute,
aes(x = Group, y = 12, angle = 90,
label = Letter),
position = position_nudge(x = 0.1),
hjust = 0,
color = "red")
有没有人经历过这种情况?我尝试搜索,但找不到任何答案。
推荐答案
我是cldList()
函数的作者。因为该函数是为处理来自不同函数的不同输出而设计的,所以默认情况下它会删除空格、零和等号等字符,以便可以将结果传递给multcompView::multcompLetters
。通过删除零,在本例中,它将C1
与C10
合并。以下方法可解决此问题:
flute <-
cldList(P.adj ~ Comparison,
data = bells$res,
threshold = 0.05,
remove.zero = FALSE)
flute
这篇关于在添加紧凑型字母显示时,cldList()函数的行为异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文