r - cldList() 函数在添加紧凑型字母显示时表现异常
问题描述
我在这里问了一个问题,但现在面临另一个问题
cldList()
从包中运行后rcompanion
,它给了我一个表格,显示了每组的紧凑字母显示,但是,尽管与其他组没有显着差异,但有些组没有显示任何字母。
数据太大所以我在 这里上传
这是一个错误还是我做错了什么。
我正在使用的代码是这个
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
推荐阅读
- amazon-web-services - 我应该如何修改 AWS DynamoDB Query 通过 AWS API Gateway 返回给我的响应?
- r - 根据其他表替换数据框中的列名
- javascript - 如何选择 iframe 并将其 src 传递给函数
- python - 带有OOP的二叉搜索树python
- c# - 使用 C# 从响应头获取文件路径
- flutter - Flutter:由于上下文为空,本地化无法正常工作。如何正确地将它通过无状态传递到有状态?
- amazon-web-services - CodeCommit:删除分支时触发与通知
- laravel - Laravel 中的作曲家更新
- vert.x - 在 Quarkus 应用程序中使用 Vertx Web 路由和 Minity 的故障处理程序问题
- android - 应用主题更改时,原生基础组件的主题不更新