![tukey kramer number line tukey kramer number line](http://www.molvis.org/molvis/v21/1368/mv-v21-1368-f2.jpg)
If you want to specify the precise y location of bars, use the argument label.y: ggboxplot(ToothGrowth, x = "dose", y = "len", Stat_compare_means(label.y = 50) # Add global p-value Stat_compare_means(comparisons = my_comparisons)+ # Add pairwise comparisons p-value group1 group2 p p.adj p.format p.signif method You can change this to “t.test”.Ĭompare_means(len ~ dose, data = ToothGrowth) # A tibble: 3 x 8 If the grouping variable contains more than two levels, then pairwise tests will be performed automatically. Ggboxplot(ToothGrowth, x = "dose", y = "len", Plot with global p-value: # Default method = "kruskal.test" for multiple groups If you prefer, it’s also possible to specify the argument label as a character vector: p + stat_compare_means( label = "p.signif", label.x = 1.5, label.y = 40)Ĭompare_means(len ~ dose, data = ToothGrowth, method = "anova") # A tibble: 1 x 6 p.format.)): Use line break (“\n”) between the method name and the p-value.Īs an illustration, type this: p + stat_compare_means( aes(label =. p.signif.): display only the significance level. p.format.)): display only the formatted p-value (without the method name) You can specify other combinations using the aes() function. The default p-value label displayed is obtained by concatenating the method and the p columns of the returned data frame by the function compare_means(). Note that, the p-value label position can be adjusted using the arguments: label.x, label.y, hjust and vjust. P + stat_compare_means(method = "t.test")