【发布时间】:2019-11-09 12:24:16
【问题描述】:
我正在尝试创建一个箱线图并手动将 p 值添加到箱线图之间的每个比较中:
#I have the following boxplot
ToothGrowth%>%ggplot(aes(x=dose, y=len, fill=supp))+
geom_boxplot()
#I would like to do a wilcoxon sum rank test on the data and label each comparison between OJ and VC
stat.test <- ToothGrowth%>%group_by(dose)%>%wilcox_test(len~supp, p.adjust.method = 'BH')%>%
mutate(y.position = c(29, 35, 39))
stat.test
#I try to add the p-values to my boxplots
ToothGrowth%>%ggplot(aes(x=dose, y=len, fill=supp))+
geom_boxplot()+
stat_pvalue_manual(stat.test, label = 'p')
#However I get the following error:
# Error in FUN(X[[i]], ...) : object 'supp' not found
【问题讨论】:
-
欢迎来到 Stack Overflow!您提供了一些有用的详细信息,但您的问题仍然缺少关键信息;请参阅 SO 的 How do I ask a good question? 和 How to create a Minimum, Complete, Verifiable Example,了解如何改进您的问题并让其他人更实际地帮助您