我可以在沒有警告的情況下對資料運行 t 檢驗或 Wilcoxon 檢驗,但是當我嘗試使用ggpubr's 函式stat_pvalue_manual()進行繪圖時出現錯誤ggplot2
- t 檢驗作業得很好:
### runing a t-test (no problem):
t.test(data$SUJ_PRE ~ AMOSTRA, data = data, exact = F)
- 但我得到錯誤
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
我收到
SUJ_PRE了 'x' 的錯誤,但我也收到了帶有另一個變數的 'y' 訊息。對此有什么想法嗎?我似乎有一些
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/527537.html標籤:rggplot2t检验
