Using the ToothGrowth dataset (built into R), I have used the following code.
library(ggplot2)
library(tidyverse)
library(ggpubr)
p <- ggboxplot(ToothGrowth, x = "supp", y = "len",
color = "supp", palette = "jco",
add = "jitter",
facet.by = "dose", short.panel.labs = FALSE)
p + stat_compare_means(label = "p.format")
Now, I would like the p values to have 4 digits. I researched previous similar posts and then tried the following two options
p + stat_compare_means(label = "p.format", digits = 4)
p + stat_compare_means(label = "p.format", round(p.format, 4))
Unfortunately, neither worked. Might anybody have a solution? Thank you.
ggboxplot
andstat_compare_means
from? Always explicitly include anylibrary
calls to external non-base R packages. – Electromotor