2

我正在尝试使用 ggplot2 在多个图形上添加 p 值,并且它运行良好(图 1),直到我尝试使用 scales="free"。当我免费添加秤时,它会收到一个Warning messages: 1: Computation failed in stat_compare_means(: group1, p must resolve to integer column positions, not NULL

我的数据框:

    > burst.data
      Host Clade   Phage Burst.Size
1   CC9605     A S-TIP28         20
2   CC9605     A S-TIP28         25
3   CC9605     A S-TIP28         38
4   CC9605     A S-TIP28         44
5   CC9605     A S-TIP28         56
6   CC9605     A S-TIP28         56
7   CC9605     A S-TIP28         59
8   CC9605     A S-TIP28         61

没有尺度的代码 = 免费:

ggplot(burst.data, aes(Phage, Burst.Size,fill=Clade))+
  geom_boxplot(width=0.75,outlier.size=5,size=1.5)+
  facet_wrap( ~ Host,nrow = 1)+
  stat_compare_means( )

图片: 在此处输入图片描述

但是当我尝试使用 scales = "free" 仅显示每个图的相关数据时,stat_compare_means( ) 会发出警告,而不是将 p 值添加到图中:

> ggplot(burst.data, aes(Phage, Burst.Size,fill=Clade))+
+   geom_boxplot()+
+   facet_wrap( ~ Host,scales = "free",nrow = 1)+
+   stat_compare_means( )
Warning messages:
1: Computation failed in `stat_compare_means()`:
`group1`, `p` must resolve to integer column positions, not NULL 
2: Computation failed in `stat_compare_means()`:
`group1`, `p` must resolve to integer column positions, not NULL 
3: Computation failed in `stat_compare_means()`:
`group1`, `p` must resolve to integer column positions, not NULL 

在此处输入图像描述

4

0 回答 0