我用回归线和系数绘制了一个散点图,并获得了非常显着的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))+
相同,相关性较小: