Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Statistical report not appearing #960

Open
manoelsiq opened this issue Sep 23, 2024 · 5 comments
Open

Statistical report not appearing #960

manoelsiq opened this issue Sep 23, 2024 · 5 comments

Comments

@manoelsiq
Copy link

Even though the function to report the statistical test results is activated (results.subtitle = TRUE), the results do not appear in all graphs. In some, they do not appear for no apparent reason. Below is the code I am using:

ggstatsplot::ggbarstats(
data = det2019,
x = VD,
y = deslocamento,
xlab = "Deslocamentos",
ylab = "Percentual",
digits.perc = 1,
label.text.size = 4,
package = "wesanderson",
palette = "Royal1",
messages = FALSE,
bf.message = FALSE,
results.subtitle = TRUE,
proportion.test = FALSE) +
theme(legend.position = "bottom")

@IndrajeetPatil
Copy link
Owner

Can you please provide a reproducible example? I don't know what det2019 is.

@manoelsiq
Copy link
Author

manoelsiq commented Sep 23, 2024

Sure. This is a version of my dataset:

ausencia_desl1 <- rep("Deslocamento 1", 456)
ausencia_desl2 <- rep("Deslocamento 2", 321)
ausencia_desl3 <- rep("Deslocamento 3", 339)
ausencia_desl4 <- rep("Deslocamento 4", 334)
presenca_desl1 <- rep("Deslocamento 1", 392)
presenca_desl2 <- rep("Deslocamento 2", 295)
presenca_desl3 <- rep("Deslocamento 3", 299)
presenca_desl4 <- rep("Deslocamento 4", 359)


deslocamentos <- c(ausencia_desl1, ausencia_desl2, ausencia_desl3, ausencia_desl4, presenca_desl1, presenca_desl2, presenca_desl3, presenca_desl4)


VD <- factor(c(rep("ausência", 1450), rep("presença", 1345)))


set.seed(123)  
deslocamentos <- sample(deslocamentos)
VD <- sample(VD)


det2019 <- data.frame(VD, deslocamentos)

However, the statistical tests are not reported when using the code (with my dataset).

ggstatsplot::ggbarstats(
  data = det2019,
  x = VD,
  y = deslocamentos,
  xlab = "Deslocamentos",
  ylab = "Percentual",
  digits.perc = 1,
  label.text.size = 4,
  package = "wesanderson",
  palette = "Royal1",
  messages = FALSE,
  bf.message = FALSE,
  results.subtitle = TRUE,
  proportion.test = FALSE) + 
  theme(legend.position = "bottom")

The figure looks like the one attached, with no statistical report (I know it's not significant, but the reporting in the figure is important):
Rplot

@IndrajeetPatil
Copy link
Owner

I can't reproduce this behaviour. What version of {ggstatsplot} are you using?

ausencia_desl1 <- rep("Deslocamento 1", 456)
ausencia_desl2 <- rep("Deslocamento 2", 321)
ausencia_desl3 <- rep("Deslocamento 3", 339)
ausencia_desl4 <- rep("Deslocamento 4", 334)
presenca_desl1 <- rep("Deslocamento 1", 392)
presenca_desl2 <- rep("Deslocamento 2", 295)
presenca_desl3 <- rep("Deslocamento 3", 299)
presenca_desl4 <- rep("Deslocamento 4", 359)


deslocamentos <- c(
  ausencia_desl1,
  ausencia_desl2,
  ausencia_desl3,
  ausencia_desl4,
  presenca_desl1,
  presenca_desl2,
  presenca_desl3,
  presenca_desl4
)

VD <- factor(c(rep("ausência", 1450), rep("presença", 1345)))

set.seed(123)
deslocamentos <- sample(deslocamentos)
VD <- sample(VD)
det2019 <- data.frame(VD, deslocamentos)

library(ggstatsplot)

ggbarstats(
  data = det2019,
  x = VD,
  y = deslocamentos
)

Created on 2024-09-29 with reprex v2.1.1

Session info

sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.4.1 (2024-06-14)
#>  os       macOS 15.0
#>  system   aarch64, darwin20
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       Europe/Berlin
#>  date     2024-09-29
#>  pandoc   3.4 @ /usr/local/bin/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package          * version     date (UTC) lib source
#>  BayesFactor        0.9.12-4.7  2024-01-24 [2] CRAN (R 4.4.0)
#>  bayestestR         0.14.0.7    2024-09-15 [1] Github (easystats/bayestestR@43819c7)
#>  cli                3.6.3       2024-06-21 [1] CRAN (R 4.4.0)
#>  coda               0.19-4.1    2024-01-31 [2] CRAN (R 4.4.0)
#>  codetools          0.2-20      2024-03-31 [2] CRAN (R 4.4.1)
#>  colorspace         2.1-1       2024-07-26 [2] CRAN (R 4.4.0)
#>  correlation        0.8.5       2024-06-16 [2] RSPM (R 4.4.0)
#>  curl               5.2.3       2024-09-20 [1] CRAN (R 4.4.1)
#>  datawizard         0.12.3.3    2024-09-15 [1] Github (easystats/datawizard@a1fe5f8)
#>  digest             0.6.37      2024-08-19 [1] CRAN (R 4.4.1)
#>  dplyr              1.1.4       2023-11-17 [2] CRAN (R 4.4.0)
#>  effectsize         0.8.9       2024-09-15 [1] Github (easystats/effectsize@59d6143)
#>  emmeans            1.10.4      2024-08-21 [2] CRAN (R 4.4.1)
#>  estimability       1.5.1       2024-05-12 [2] RSPM (R 4.4.0)
#>  evaluate           1.0.0       2024-09-17 [1] CRAN (R 4.4.1)
#>  fansi              1.0.6       2023-12-08 [1] CRAN (R 4.4.0)
#>  farver             2.1.2       2024-05-13 [2] RSPM (R 4.4.0)
#>  fastmap            1.2.0       2024-05-15 [1] CRAN (R 4.4.0)
#>  fs                 1.6.4       2024-04-25 [1] CRAN (R 4.4.0)
#>  generics           0.1.3       2022-07-05 [2] CRAN (R 4.4.0)
#>  ggplot2            3.5.1       2024-04-23 [2] CRAN (R 4.4.0)
#>  ggstatsplot      * 0.12.4.9000 2024-07-27 [1] local
#>  glue               1.7.0       2024-01-09 [1] CRAN (R 4.4.0)
#>  gtable             0.3.5       2024-04-22 [2] CRAN (R 4.4.0)
#>  highr              0.11        2024-05-26 [1] CRAN (R 4.4.0)
#>  htmltools          0.5.8.1     2024-04-04 [1] CRAN (R 4.4.0)
#>  insight            0.20.4.3    2024-09-15 [1] Github (easystats/insight@6ce94be)
#>  knitr              1.48        2024-07-07 [1] CRAN (R 4.4.0)
#>  lattice            0.22-6      2024-03-20 [2] CRAN (R 4.4.1)
#>  lifecycle          1.0.4       2023-11-07 [1] CRAN (R 4.4.0)
#>  magrittr           2.0.3       2022-03-30 [1] CRAN (R 4.4.0)
#>  MASS               7.3-60.2    2024-04-26 [2] CRAN (R 4.4.1)
#>  Matrix             1.7-0       2024-04-26 [2] CRAN (R 4.4.1)
#>  MatrixModels       0.5-3       2023-11-06 [2] RSPM
#>  multcomp           1.4-26      2024-07-18 [2] CRAN (R 4.4.0)
#>  munsell            0.5.1       2024-04-01 [2] CRAN (R 4.4.0)
#>  mvtnorm            1.3-1       2024-09-03 [2] CRAN (R 4.4.1)
#>  paletteer          1.6.0       2024-01-21 [2] CRAN (R 4.4.0)
#>  parameters         0.22.2.7    2024-09-15 [1] Github (easystats/parameters@37509c2)
#>  patchwork          1.2.0       2024-01-08 [2] CRAN (R 4.4.0)
#>  pbapply            1.7-2       2023-06-27 [2] CRAN (R 4.4.0)
#>  pillar             1.9.0       2023-03-22 [1] CRAN (R 4.4.0)
#>  pkgconfig          2.0.3       2019-09-22 [1] CRAN (R 4.4.0)
#>  prismatic          1.1.2       2024-04-10 [2] RSPM
#>  purrr              1.0.2       2023-08-10 [1] CRAN (R 4.4.0)
#>  R6                 2.5.1       2021-08-19 [1] CRAN (R 4.4.0)
#>  Rcpp               1.0.13      2024-07-17 [1] CRAN (R 4.4.0)
#>  rematch2           2.1.2       2020-05-01 [2] RSPM
#>  reprex             2.1.1       2024-07-06 [2] CRAN (R 4.4.1)
#>  rlang              1.1.4       2024-06-04 [1] CRAN (R 4.4.0)
#>  rmarkdown          2.28        2024-08-17 [1] CRAN (R 4.4.0)
#>  rstudioapi         0.16.0      2024-03-24 [2] CRAN (R 4.4.0)
#>  sandwich           3.1-0       2023-12-11 [2] CRAN (R 4.4.0)
#>  scales             1.3.0       2023-11-28 [2] CRAN (R 4.4.0)
#>  sessioninfo        1.2.2       2021-12-06 [2] RSPM
#>  statsExpressions   1.6.0       2024-09-08 [1] CRAN (R 4.4.1)
#>  stringi            1.8.4       2024-05-06 [2] RSPM (R 4.4.0)
#>  stringr            1.5.1       2023-11-14 [2] RSPM
#>  survival           3.6-4       2024-04-24 [2] CRAN (R 4.4.1)
#>  TH.data            1.1-2       2023-04-17 [2] CRAN (R 4.4.0)
#>  tibble             3.2.1       2023-03-20 [1] CRAN (R 4.4.0)
#>  tidyr              1.3.1       2024-01-24 [2] CRAN (R 4.4.0)
#>  tidyselect         1.2.1       2024-03-11 [2] CRAN (R 4.4.0)
#>  utf8               1.2.4       2023-10-22 [1] CRAN (R 4.4.0)
#>  vctrs              0.6.5       2023-12-01 [1] CRAN (R 4.4.0)
#>  withr              3.0.1       2024-07-31 [1] CRAN (R 4.4.1)
#>  xfun               0.47        2024-08-17 [1] CRAN (R 4.4.0)
#>  xml2               1.3.6       2023-12-04 [1] CRAN (R 4.4.0)
#>  xtable             1.8-4       2019-04-21 [1] CRAN (R 4.4.0)
#>  yaml               2.3.10      2024-07-26 [1] CRAN (R 4.4.1)
#>  zeallot            0.1.0       2018-01-28 [2] RSPM
#>  zoo                1.8-12      2023-04-13 [2] CRAN (R 4.4.0)
#> 
#>  [1] /Users/indrajeetpatil/Library/R/arm64/4.4/library
#>  [2] /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────

@manoelsiq
Copy link
Author

I'm using the same version as you. I'm attaching my files, if it helps.
data.zip

@urosgodnov
Copy link

Hi, I also get the same problem. In a for loop I am creating bar charts and some of them have the statistics, some of them not. I am having the latest ggstatsplot.

image

image

And another question. How can I edit the size of the counts?

Uros

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants