Use ggpubr to add statistics to plots.
addPlotStats(
p,
comp.group,
metadata,
h.adj = 0.05,
primary.test,
secondary.test,
exact = FALSE
)
ggplot2 object
Plot to add statistics to.
Comparison metric.
Metadata for samples.
Position of statistics test p value as % of max(y) (default = 0.05).
Primary statistical test, e.g. "anova", "kruskal.test".
Secondary statistical test, e.g. "t-test", "wilcox.test"
Whether to calculate exact p values (default = FALSE).