IndrajeetPatil / ggstatsplot

Enhancing {ggplot2} plots with statistical analysis 📊📣
https://indrajeetpatil.github.io/ggstatsplot/
GNU General Public License v3.0
2.04k stars 190 forks source link

bug for the ggbetweenstats #751

Closed Charmy0619 closed 2 years ago

Charmy0619 commented 2 years ago

Hi, I am trying to run ggbetweenstats, but I got the error message. Could you help with this problem? Thank you so much.

(.packages()) [1] "sp" "stats" "graphics" "grDevices" "utils" "datasets" "methods" "base"
library(ggplot2) Warning message: package ‘ggplot2’ was built under R version 4.1.3 library(ggstatsplot) You can cite this package as: Patil, I. (2021). Visualizations with statistical details: The 'ggstatsplot' approach. Journal of Open Source Software, 6(61), 3167, doi:10.21105/joss.03167 Warning message: package ‘ggstatsplot’ was built under R version 4.1.3 p4 <-ggbetweenstats( data = iris, plot.type = 'violin', x = Species, y = Sepal.Length, expand_y = TRUE, messages=FALSE, pairwise.comparisons=FALSE, centrality.plotting = FALSE, type='p', palette='Set1') + scale_y_continuous(breaks=seq(2,4,by=1))+ theme_bw() + theme(legend.position='top')

p4 Error in titleGrob(label, x, y, hjust = hj, vjust = vj, angle = angle, : unused argument (expand_y = TRUE) ggbetweenstats(mtcars, am, mpg) Error in mutate_cols(): ! Problem with mutate() column n_label. i n_label = paste0(am, "\n(n = ", .prettyNum(n), ")"). x values must be length 1, but FUN(X[[1]]) result is length 3 Caused by error in vapply(): ! values must be length 1, but FUN(X[[1]]) result is length 3 Run rlang::last_error() to see where the error occurred.

sessionInfo() R version 4.1.2 (2021-11-01) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C LC_TIME=English_United States.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] ggstatsplot_0.9.1 ggplot2_3.3.6 sp_1.4-6

IndrajeetPatil commented 2 years ago

Duplicate of https://github.com/IndrajeetPatil/ggstatsplot/issues/749

For solution, please see this comment: https://github.com/IndrajeetPatil/ggstatsplot/issues/749#issuecomment-1127598818

Charmy0619 commented 2 years ago

I ran that 2 codes remotes::install_github("IndrajeetPatil/statsExpressions") remotes::install_github("IndrajeetPatil/ggstatsplot")

and then I tried to

library(ggstatsplot) Error: package or namespace load failed for ‘ggstatsplot’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): namespace ‘statsExpressions’ 1.3.1 is already loaded, but >= 1.3.1.9000 is required

IndrajeetPatil commented 2 years ago

namespace ‘statsExpressions’ 1.3.1 is already loaded, but >= 1.3.1.9000 is required

This means you still haven't updated to the GitHub version of statsExpressions.

Please refresh your R session and updated packages.

Charmy0619 commented 2 years ago

I can load the package now, but I still have the error. Did I do something wrong?

library(ggplot2) Warning message: package ‘ggplot2’ was built under R version 4.1.3 library(ggstatsplot) You can cite this package as: Patil, I. (2021). Visualizations with statistical details: The 'ggstatsplot' approach. Journal of Open Source Software, 6(61), 3167, doi:10.21105/joss.03167 p4 <-ggbetweenstats(

  • data = iris,
  • plot.type = 'violin',
  • x = Species,
  • y = Sepal.Length,
  • expand_y = TRUE,
  • messages=FALSE,
  • pairwise.comparisons=FALSE,
  • centrality.plotting = FALSE,
  • type='p',
  • palette='Set1') +
  • scale_y_continuous(breaks=seq(2,4,by=1))+
  • theme_bw() +
  • theme(legend.position='top') Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale. p4 Error in titleGrob(label, x, y, hjust = hj, vjust = vj, angle = angle, : unused argument (expand_y = TRUE) (.packages()) [1] "ggstatsplot" "ggplot2" "sp" "stats" "graphics" "grDevices"
    [7] "utils" "datasets" "methods" "base"

    detach("package:sp")

    remotes::install_github("IndrajeetPatil/statsExpressions")

    remotes::install_github("IndrajeetPatil/ggstatsplot")

    sessionInfo() R version 4.1.2 (2021-11-01) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] ggstatsplot_0.9.1.9000 ggplot2_3.3.6 sp_1.4-6

loaded via a namespace (and not attached): [1] nlme_3.1-157 fs_1.5.2 ggtree_3.2.1
[4] usethis_2.1.5 devtools_2.4.3 insight_0.17.1
[7] rprojroot_2.0.3 latex2exp_0.9.4 tensorA_0.36.2
[10] tools_4.1.2 utf8_1.2.2 R6_2.5.1
[13] statsExpressions_1.3.1.9000 DBI_1.1.2 lazyeval_0.2.2
[16] colorspace_2.0-3 withr_2.5.0 tidyselect_1.1.2
[19] gridExtra_2.3 prettyunits_1.1.1 processx_3.5.3
[22] bayesm_3.1-4 compiler_4.1.2 compositions_2.0-4
[25] performance_0.9.0 cli_3.3.0 desc_1.4.1
[28] prismatic_1.1.0 bayestestR_0.12.1 scales_1.2.0
[31] mvtnorm_1.1-3 DEoptimR_1.0-11 robustbase_0.95-0
[34] readr_2.1.2 pbapply_1.5-0 ggridges_0.5.3
[37] callr_3.7.0 digest_0.6.29 stringr_1.4.0
[40] yulab.utils_0.0.4 pkgconfig_2.0.3 sessioninfo_1.2.2
[43] fastmap_1.1.0 rlang_1.0.2 ggthemes_4.2.4
[46] readxl_1.4.0 rstudioapi_0.13 farver_2.1.0
[49] gridGraphics_0.5-1 generics_0.1.2 jsonlite_1.8.0
[52] gtools_3.9.2 dplyr_1.0.9 magrittr_2.0.3
[55] ggplotify_0.1.0 parameters_0.17.0.12 patchwork_1.1.1
[58] Matrix_1.4-1 Rcpp_1.0.8.3 munsell_0.5.0
[61] fansi_1.0.3 ape_5.6-2 proto_1.0.0
[64] lifecycle_1.0.1 stringi_1.7.6 MASS_7.3-57
[67] brio_1.1.3 pkgbuild_1.3.1 plyr_1.8.7
[70] grid_4.1.2 paletteer_1.4.0 parallel_4.1.2
[73] ggrepel_0.9.1 crayon_1.5.1 lattice_0.20-45
[76] cowplot_1.1.1 hms_1.1.1 zeallot_0.1.0
[79] ps_1.7.0 pillar_1.7.0 effectsize_0.6.0.1
[82] pkgload_1.2.4 rstantools_2.2.0 glue_1.6.2
[85] ggfun_0.0.6 remotes_2.4.2 BiocManager_1.30.18
[88] vctrs_0.4.1 treeio_1.18.1 tzdb_0.3.0
[91] testthat_3.1.4 MatrixModels_0.5-0 cellranger_1.1.0
[94] gtable_0.3.0 purrr_0.3.4 BayesFactor_0.9.12-4.3
[97] tidyr_1.2.0 rematch2_2.1.2 assertthat_0.2.1
[100] datawizard_0.4.1 cachem_1.0.6 correlation_0.8.0
[103] tidytree_0.3.9 coda_0.19-4 tibble_3.1.7
[106] aplot_0.1.4 memoise_2.0.1 ggtern_3.3.5
[109] ellipsis_0.3.2

ggbetweenstats(mtcars, am, mpg) Error in titleGrob(label, x, y, hjust = hj, vjust = vj, angle = angle, : unused argument (expand_y = TRUE) p4 <-ggbetweenstats(

  • data = iris,
  • plot.type = 'violin',
  • x = Species,
  • y = Sepal.Length,
  • expand_y = TRUE,
  • messages=FALSE,
  • pairwise.comparisons=FALSE,
  • centrality.plotting = FALSE,
  • type='p',
  • palette='Set1') +
  • scale_y_continuous(breaks=seq(2,4,by=1))+
  • theme_bw() +
  • theme(legend.position='top') Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale. p4 Error in titleGrob(label, x, y, hjust = hj, vjust = vj, angle = angle, : unused argument (expand_y = TRUE)
Charmy0619 commented 2 years ago

hmmmm... Am I the only one that have this problem?