I'm able to run a t-test or a Wilcoxon test on the data with no warnings, but I get an error when I try to plot in with ggpubr
's function stat_pvalue_manual()
in ggplot2
- The t-test works just fine:
### runing a t-test (no problem):
t.test(data$SUJ_PRE ~ AMOSTRA, data = data, exact = F)
- But I get the error in
stat_pvalue_manual
:
### trying to plot it:
data %>%
ggplot(., aes(x = AMOSTRA, y = SUJ_PRE))
stat_boxplot(geom = "errorbar",
width = 0.15)
geom_boxplot(aes(fill = AMOSTRA), outlier.colour = "#9370DB", outlier.shape = 19,
outlier.size= 2, notch = T)
scale_fill_manual(values = c("PB" = "#E6E6FA", "PE" = "#CCCCFF"),
label = c("PB" = "PB", "PE" = "PE"),
name = "Amostra:")
stat_summary(fun = mean, geom = "point", shape = 20, size= 5, color= "#9370DB")
stat_pvalue_manual(data %>%
t_test(SUJ_PRE ~ AMOSTRA) %>%
add_xy_position(),
label = "t = {round(statistic, 2)}, p = {p}")
Error in `mutate()`:
! Problem while computing `data = map(.data$data, .f, ...)`.
Caused by error in `t.test.default()`:
! not enough 'x' observations