首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >cldList()函数在添加紧凑型字母显示时行为怪异

cldList()函数在添加紧凑型字母显示时行为怪异
EN

Stack Overflow用户
提问于 2021-10-07 13:43:50
回答 1查看 622关注 0票数 0

我问了一个问题,这里,但现在又面临另一个问题

在从包cldList()运行rcompanion之后,它给了我一个表格,显示每个组的紧凑型字母显示,但是,一些组不显示任何字母,尽管与其他组没有显着性差异。

数据太大了,所以我要上传它这里

这是窃听器还是我做错了什么。

我使用的代码是这个

代码语言:javascript
复制
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")

有人经历过吗?我试图寻找,但没有找到任何答案。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-11-26 16:06:23

我是cldList()函数的作者。由于该函数旨在处理来自不同函数的各种输出,因此默认情况下它会删除空格、零和等号等字符,这样就可以将结果传递给multcompView::multcompLetters。通过移除零,在本例中,它将C1C10混为一谈。以下方法解决了这个问题:

代码语言:javascript
复制
flute <-
  cldList(P.adj ~ Comparison,
          data = bells$res,
          threshold = 0.05,
          remove.zero = FALSE)
flute
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69482320

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档