Issue with geom_pwc() and tukey_hsd test
phisanti opened this issue · comments
Cano-Muniz, Santiago commented
Expected behavior
I would like to show the output of a tukey_hsd on a grouped boxplot/barplot within the categories. I am able to do that with the t_test function, and I am able to do the turkey_hsd between categories. However, I am not able to do that in the tukey_hsd within category.
Actual behavior
Currently I got the following error:
Warning message:
Computation failed in `stat_pwc()`
Caused by error in `mutate()`:
ℹ In argument: `data = map(.data$data, .f, ...)`.
Caused by error in `map()`:
ℹ In index: 1.
Caused by error in `TukeyHSD.aov()`:
! no factors in the fitted model
Steps to reproduce the problem
Here is the code that I use for a reproducible example:
d <- data.table(ToothGrowth)
bxp <- ggboxplot(
d, x = "dose_factor", y = "len",
color = "supp", palette = c("#00AFBB", "#E7B800")
)
bxp + geom_pwc(
aes_string(group = "supp", #color = supp
),
method = "tukey_hsd", label = "p.adj.signif",
p.adjust.method = "bonferroni", p.adjust.by = "group",
tip.length = 0, group.by = "legend.var"
)
bxp + geom_pwc(
aes_string(group = "supp", col = 'supp'),
method = "tukey_hsd", label = "p.format"#, group.by = "legend.var"
)
bxp + geom_pwc(
aes_string(group = "supp", col = 'supp'),
method = "t_test", label = "p.format"#, group.by = "legend.var"
)
session_info()
─ Session info ──────────────────────────────────────────────────────────
setting value
version R version 4.2.2 (2022-10-31 ucrt)
os Windows 10 x64 (build 19045)
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United Kingdom.utf8
ctype English_United Kingdom.utf8
tz Europe/London
date 2023-04-03
rstudio 2023.03.0+386 Cherry Blossom (desktop)
pandoc NA
─ Packages ──────────────────────────────────────────────────────────────
! package * version date (UTC) lib source
P abind 1.4-5 2016-07-21 [?] CRAN (R 4.2.0)
P attachment 0.3.1 2023-01-27 [?] CRAN (R 4.2.2)
P attempt 0.3.1 2020-05-03 [?] CRAN (R 4.2.2)
P backports 1.4.1 2021-12-13 [?] CRAN (R 4.2.0)
P broom 1.0.4 2023-03-11 [?] CRAN (R 4.2.2)
P cachem 1.0.7 2023-02-24 [?] CRAN (R 4.2.2)
P callr 3.7.3 2022-11-02 [?] CRAN (R 4.2.2)
P car 3.1-1 2022-10-19 [?] CRAN (R 4.2.2)
P carData 3.0-5 2022-01-06 [?] CRAN (R 4.2.2)
P cli 3.6.0 2023-01-09 [?] CRAN (R 4.2.2)
colorspace 2.1-0 2023-01-23 [1] CRAN (R 4.2.2)
P config 0.3.1 2020-12-17 [?] CRAN (R 4.2.2)
P crayon 1.5.2 2022-09-29 [?] CRAN (R 4.2.2)
data.table * 1.14.8 2023-02-17 [1] CRAN (R 4.2.2)
desc 1.4.2 2022-09-08 [1] CRAN (R 4.2.2)
P devtools 2.4.5 2022-10-11 [?] CRAN (R 4.2.2)
P digest 0.6.31 2022-12-11 [?] CRAN (R 4.2.2)
P dplyr 1.1.0 2023-01-29 [?] CRAN (R 4.2.2)
P ellipsis 0.3.2 2021-04-29 [?] CRAN (R 4.2.2)
fansi 1.0.4 2023-01-22 [1] CRAN (R 4.2.2)
farver 2.1.1 2022-07-06 [1] CRAN (R 4.2.2)
P fastmap 1.1.1 2023-02-24 [?] CRAN (R 4.2.2)
P fs 1.6.1 2023-02-06 [?] CRAN (R 4.2.2)
P generics 0.1.3 2022-07-05 [?] CRAN (R 4.2.2)
ggplot2 * 3.4.1 2023-02-10 [1] CRAN (R 4.2.2)
P ggpubr * 0.6.0 2023-02-10 [?] CRAN (R 4.2.2)
P ggsignif 0.6.4 2022-10-13 [?] CRAN (R 4.2.2)
P glue 1.6.2 2022-02-24 [?] CRAN (R 4.2.2)
P golem 0.4.0 2023-03-12 [?] CRAN (R 4.2.2)
gtable 0.3.2 2023-03-17 [1] CRAN (R 4.2.3)
P htmltools 0.5.4 2022-12-07 [?] CRAN (R 4.2.2)
htmlwidgets 1.6.2 2023-03-17 [1] CRAN (R 4.2.3)
P httpuv 1.6.9 2023-02-14 [?] CRAN (R 4.2.2)
knitr 1.42 2023-01-25 [1] CRAN (R 4.2.2)
labeling 0.4.2 2020-10-20 [1] CRAN (R 4.2.0)
P later 1.3.0 2021-08-18 [?] CRAN (R 4.2.2)
P lifecycle 1.0.3 2022-10-07 [?] CRAN (R 4.2.2)
P magrittr * 2.0.3 2022-03-30 [?] CRAN (R 4.2.2)
P memoise 2.0.1 2021-11-26 [?] CRAN (R 4.2.2)
P mime 0.12 2021-09-28 [?] CRAN (R 4.2.0)
P miniUI 0.1.1.1 2018-05-18 [?] CRAN (R 4.2.2)
munsell 0.5.0 2018-06-12 [1] CRAN (R 4.2.2)
pillar 1.8.1 2022-08-19 [1] CRAN (R 4.2.2)
P pkgbuild 1.4.0 2022-11-27 [?] CRAN (R 4.2.2)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.2)
pkgload 1.3.2 2022-11-16 [1] CRAN (R 4.2.2)
P prettyunits 1.1.1 2020-01-24 [?] CRAN (R 4.2.2)
P processx 3.8.0 2022-10-26 [?] CRAN (R 4.2.2)
P profvis 0.3.7 2020-11-02 [?] CRAN (R 4.2.2)
P promises 1.2.0.1 2021-02-11 [?] CRAN (R 4.2.2)
P ps 1.7.2 2022-10-26 [?] CRAN (R 4.2.2)
purrr 1.0.1 2023-01-10 [1] CRAN (R 4.2.2)
P R6 2.5.1 2021-08-19 [?] CRAN (R 4.2.2)
P ragg 1.2.5 2023-01-12 [?] CRAN (R 4.2.2)
P Rcpp 1.0.10 2023-01-22 [?] CRAN (R 4.2.2)
P remotes 2.4.2 2021-11-30 [?] CRAN (R 4.2.2)
renv 0.17.0 2023-03-02 [1] CRAN (R 4.2.2)
P rlang 1.1.0 2023-03-14 [?] CRAN (R 4.2.2)
roxygen2 7.2.3 2022-12-08 [1] CRAN (R 4.2.2)
P rprojroot 2.0.3 2022-04-02 [?] CRAN (R 4.2.2)
P rstatix * 0.7.2 2023-02-01 [?] CRAN (R 4.2.2)
P rstudioapi 0.14 2022-08-22 [?] CRAN (R 4.2.2)
scales 1.2.1 2022-08-20 [1] CRAN (R 4.2.2)
P sessioninfo 1.2.2 2021-12-06 [?] CRAN (R 4.2.2)
P shiny 1.7.4 2022-12-15 [?] CRAN (R 4.2.2)
shinythemes 1.2.0 2021-01-25 [1] CRAN (R 4.2.2)
P stargazer 5.2.3 2022-03-04 [?] CRAN (R 4.2.0)
stringi 1.7.12 2023-01-11 [1] CRAN (R 4.2.2)
stringr 1.5.0 2022-12-02 [1] CRAN (R 4.2.2)
P systemfonts 1.0.4 2022-02-11 [?] CRAN (R 4.2.2)
P textshaping 0.3.6 2021-10-13 [?] CRAN (R 4.2.2)
tibble 3.2.1 2023-03-20 [1] CRAN (R 4.2.2)
P tidyr 1.3.0 2023-01-24 [?] CRAN (R 4.2.2)
P tidyselect 1.2.0 2022-10-10 [?] CRAN (R 4.2.2)
P urlchecker 1.0.1 2021-11-30 [?] CRAN (R 4.2.2)
P usethis 2.1.6 2022-05-25 [?] CRAN (R 4.2.2)
utf8 1.2.3 2023-01-31 [1] CRAN (R 4.2.2)
vctrs 0.6.0 2023-03-16 [1] CRAN (R 4.2.2)
P withr 2.5.0 2022-03-03 [?] CRAN (R 4.2.2)
xfun 0.37 2023-01-31 [1] CRAN (R 4.2.2)
xml2 1.3.3 2021-11-30 [1] CRAN (R 4.2.2)
P xtable 1.8-4 2019-04-21 [?] CRAN (R 4.2.2)
P yaml 2.3.7 2023-01-23 [?] CRAN (R 4.2.2)
[1] C:/Users/tisal/AppData/Local/R/cache/R/renv/library/free-prism-a958960a/R-4.2/x86_64-w64-mingw32
[2] C:/Users/tisal/AppData/Local/R/cache/R/renv/sandbox/R-4.2/x86_64-w64-mingw32/30182023````