library(ggplot2)
library(tidyverse)
library(ggpubr)
my_comp <- list( c("0.5", "1"), c("1", "2"), c("0.5", "2") )
ggboxplot(ToothGrowth,
x = "dose",
y = "len",
fill = "dose",
palette = "Dark2")+
stat_compare_means(label = "p.format",
comparisons = my_comp,
method = "t.test",
symnum.args = list(cutpoints = c(0, 0.001, 1),
symbols = "p < 0.001"))