I am using the stat_compare_means() plotting function from gpubr in R, and I'm trying to specify a left-tailed (or alternative = "less") specification for the wilcox.test. Unfortunately I cannot get the function to give me the ability to do so.
Could anyone possibly assist in specifying an alternative?
I listed an issue on the gpubr github account but have not yet received feedback on this.
Any ideas would be great.
MWE follows:
library(dplyr)
library(ggpubr)
library(ggplot2)
Mockdata <- bind_cols(data.frame(date = rep(seq(as.Date("2003/01/01"), as.Date("2003/12/01"), "months"), 6)) %>% arrange(date),
data.frame(Universe = rep(c("SPEURO", "SP500", "World"),24), Measure = rep(c("EBITDA", "GM"), 36), Value = rnorm(72, 5, 2))) %>% mutate_at(.vars= vars(Measure, Universe), .funs = funs(as.character))
Median <- Mockdata %>% group_by(Universe, Measure) %>% summarise(Median.Measure = median(Value)) %>% filter(Universe == "JALSHAll")
# Boxplot:
ggboxplot(Mockdata, x = "Universe", y = "Value", color = "Universe", add =
"jitter", legend = "none", facet.by = "Measure", ) +
stat_compare_means(aes(label = paste0("KW: p = ", ..p.format..)))