ggpubr icon indicating copy to clipboard operation
ggpubr copied to clipboard

stat_cor to provide low p-value (and not p < 2.2e-16)

Open pforny opened this issue 3 years ago • 2 comments

Hi, I really enjoy this package and very frequently use the stat_cor function within ggplot. I have one problem though: I would like to display very low p-values and not p < 2.2e-16. Is there a way to work around this one line of code (line 221 currently) in the stat_cor function?

label <- ifelse(x < 2.2e-16, "p < 2.2e-16", paste0("p = ", x))

Any feedback is much appreciated!

pforny avatar Nov 26 '21 10:11 pforny

Hi, We're having a similar problem to this. We are comparing two sets of groups. If one comparison has a pvalue < 2.2e-16 and another one higher, then p = does not appear. Code to reproduce this error:

dt <- data.table(values = c(rnorm(1000), rnorm(1000), rnorm(1000, 10)), groups = rep(c('a','b','c'), each = 1000))
ggplot(dt, aes(groups, values)) + geom_boxplot()+ stat_compare_means(comparisons = list(c('a', 'b'), c('a', 'c')))

vyepez88 avatar Jan 19 '22 09:01 vyepez88

Hello, I am have the same question as the original post. Did you ever find a way to display the actual p value, instead of p < 2.2e-16?

Thank you!

brookeabrown avatar Sep 27 '22 16:09 brookeabrown