如何用 'p < 0.001' 替换非常重要的 p 值?

How to replace very significant p values with 'p < 0.001'?

我用回归线和系数做了一个散点图,得到了一个非常显着的p。能不能把R(1.6e-5)自动提供的p值换成'p<0.001'。

这是我的代码:

CorFrame2 <- data.frame(FFR2,iFR2)
ggplot(CorFrame2,aes(x=iFR2,y=FFR2))+
... +
stat_cor(aes(label = paste(..rr.label.., ..p.label.., sep = "~`,`~")),
       label.x = 0.20,label.y = 0.90,size=5)

ggpubr::stat_cor 创建一个名为 ..p.label.. 的字符串——我们可以将其转换为数字,评估它是否 <0.001,并使用它来覆盖 if_else 语句中的值:

ggplot(mtcars,aes(x=wt,y=mpg))+
  geom_point() +
  ggpubr::stat_cor(
    aes(label = paste(..rr.label..,
                      if_else(readr::parse_number(..p.label..) < 0.001, 
                              "p<0.001", ..p.label..), sep = "~`,   `~")),
           label.x = 0.20,label.y = 0.90,size=5)

ggplot(mtcars,aes(x=wt,y=qsec))+ 相同,相关性较低: