R中报错Error in `ggsignif::geom_signif()`:! Problem while computing stat.ℹ Error occurred in the 2nd

最新推荐文章于 2023-11-23 10:36:10 发布
最新推荐文章于 2023-11-23 10:36:10 发布 1.9k 阅读

p=ggplot(umap)+geom_violin(aes(x=recur_T_NT,y=PHF14,fill=recur_T_NT))
p+ stat_compare_means(comparisons = list(c("NR_NT","NR_T"),c("NR_NT","R_NT"),c("NR_T","R_T"),c("R_NT","R_T")),family = "TT Times New Roman",method = "wilcox.test",label = "p.signif",#标记p值的方法
label.x = 1.5#调整p值所在位置
)

[1] FALSE
Error in `ggsignif::geom_signif()`:
! Problem while computing stat.
ℹ Error occurred in the 2nd layer.
Caused by error in `setup_params()`:
! Can only handle data with groups that are plotted on the x-axis

报错原因:发现映射关系被我写在了geom_violin()里面,因此stat_compare_means()无法读取数据,正确的写法应该如下

p=ggplot(umap,aes(x=recur_T_NT,y=PHF14,fill=recur_T_NT))+geom_violin()
p+ stat_compare_means(comparisons = list(c("NR_NT","NR_T"),c("NR_NT","R_NT"),c("NR_T","R_T"),c("R_NT","R_T")),family = "TT Times New Roman",method = "wilcox.test",label = "p.signif",#标记p值的方法
label.x = 1.5#调整p值所在位置
)

参考 ggsignif报错:Can only handle data with groups that are plotted on the x-axis-CSDN博客

Error in ` geom _sf () ` : ! Problem while computing stat . Error occurred in the 1st layer . Caused by error in ` compute_ layer () ` : ! ` stat _sf () ` requires the follow in g miss in g aes the tics : geom etry . Run ` rlang : : last_trace () ` to see where the error occurred .
Error in ` geom _smooth () ` : ! Problem while computing stat . Error occurred in the 2 nd layer . Caused by error in ` compute_ layer () ` : ! ` stat _smooth () ` requires the follow in g miss in g aes the tics : y Run ` rlang : : last_trace () ` to see where the error occurred .
Error in ` geom _density () ` : ! Problem while computing aes the tics . Error occurred in the 1st layer . Caused by error : ! 找不到对象'CPM'
in ` geom _density () ` : ! Problem while computing aes the tics . Error occurred in the 1st layer . Caused by error : ! 找不到对象'variable'
R中函数enrichKEGG报错Error in download.KEGG.Path(species) :‘species‘ should be one of organisms listed in 14793 阅读