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

factor level labels not corresponding #926

Open
pdeninis opened this issue Dec 28, 2023 · 0 comments
Open

factor level labels not corresponding #926

pdeninis opened this issue Dec 28, 2023 · 0 comments

Comments

@pdeninis
Copy link

pdeninis commented Dec 28, 2023

Hi,
it seems that the levels of the factor are exchanged in this plot (something similar to #906).

df <-
structure(list(GROUP = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L), levels = c("CONTROL", "TREAT"), class = "factor"), AGE = c(57L, 
19L, 45L, 82L, 77L, 38L, 59L, 61L, 54L, 71L, 79L, 79L, 76L, 65L, 
78L, 75L, 71L, 67L, 72L, 74L, 75L, 38L, 33L, 77L, 60L, 41L, 66L, 
81L, 40L, 69L, 54L, 72L, 44L, 67L, 78L, 63L, 93L, 87L, 33L, 80L, 
71L, 83L, 70L, 53L, 74L, 78L, 28L, 31L, 47L, 49L, 79L, 27L, 47L, 
42L, 27L, 88L, 40L, 54L, 33L, 57L, 36L, 77L, 77L, 58L, 36L, 69L, 
63L, 53L, 36L, 70L, 39L, 87L, 25L, 29L, 61L, 62L, 64L, 80L, 60L, 
43L, 66L, 77L, 57L, 39L, 46L, 79L, 29L, 75L, 48L, 48L, 46L, 77L, 
71L, 33L, 30L, 34L, 79L, 75L, 62L, 25L, 52L, 71L, 78L, 67L, 64L, 
20L, 76L, 65L, 72L, 52L, 53L, 59L, 40L, 69L, 63L, 48L, 77L, 46L, 
41L, 59L, 25L, 60L, 40L, 63L, 78L, 43L, 73L, 76L, 57L, 72L, 52L, 
78L, 43L, 67L, 40L, 40L, 44L, 41L, 71L, 69L, 25L, 44L, 46L, 56L, 
67L, 70L, 43L, 56L, 59L, 66L, 56L, 50L, 41L, 43L, 75L, 65L, 66L, 
69L, 58L, 71L, 59L, 41L, 48L, 40L, 52L, 69L, 74L, 43L, 47L, 49L, 
66L, 57L, 59L, 75L, 69L, 43L, 42L, 71L, 58L, 49L, 75L, 78L, 51L, 
61L, 62L, 60L, 75L, 54L, 44L, 74L, 74L, 67L, 59L, 72L, 41L, 48L, 
79L, 55L, 54L, 61L)), class = "data.frame", row.names = c(NA, 
-200L))

windows(18,12);df%>%group_by(GROUP)%>%plot_frq(AGE)%>%plot_grid()

tapply(df$AGE,df$GROUP,range)
$CONTROL
[1] 20 79

$TREAT
[1] 19 93

packageVersion("sjPlot")
[1] ‘2.8.15’

image

May this behavior depend on some other package not updated? How can I fix it?
Paolo

> devtools::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       Rgui
 language (EN)
 collate  Italian_Italy.utf8
 ctype    Italian_Italy.utf8
 tz       Europe/Berlin
 date     2023-12-28
 pandoc   NA

─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package              * version    date (UTC) lib source
 abind                  1.4-5      2016-07-21 [1] CRAN (R 4.2.0)
 arm                  * 1.13-1     2022-08-28 [1] CRAN (R 4.2.3)
 assertthat             0.2.1      2019-03-21 [1] CRAN (R 4.2.2)
 backports              1.4.1      2021-12-13 [1] CRAN (R 4.2.0)
 base64enc              0.1-3      2015-07-28 [1] CRAN (R 4.2.0)
 bayestestR             0.13.1     2023-04-07 [1] CRAN (R 4.2.3)
 boot                   1.3-28     2021-05-03 [1] CRAN (R 4.2.2)
 brglm                * 0.7.2      2021-04-22 [1] CRAN (R 4.2.3)
 brio                   1.1.3      2021-11-30 [1] CRAN (R 4.2.2)
 broom                  1.0.1      2022-08-29 [1] CRAN (R 4.2.2)
 cachem                 1.0.6      2021-08-19 [1] CRAN (R 4.2.2)
 callr                  3.7.3      2022-11-02 [1] CRAN (R 4.2.2)
 car                  * 3.1-1      2022-10-19 [1] CRAN (R 4.2.2)
 carData              * 3.0-5      2022-01-06 [1] CRAN (R 4.2.2)
 cellranger             1.1.0      2016-07-27 [1] CRAN (R 4.2.2)
 checkmate              2.1.0      2022-04-21 [1] CRAN (R 4.2.2)
 cli                    3.6.1      2023-03-23 [1] CRAN (R 4.2.3)
 ClinicalTrialSummary * 1.1.1      2019-01-18 [1] CRAN (R 4.2.2)
 cluster              * 2.1.4      2022-08-22 [1] CRAN (R 4.2.2)
 coda                   0.19-4     2020-09-30 [1] CRAN (R 4.2.3)
 codetools              0.2-18     2020-11-04 [1] CRAN (R 4.2.2)
 coin                 * 1.4-2      2021-10-08 [1] CRAN (R 4.2.2)
 colorspace             2.0-3      2022-02-21 [1] CRAN (R 4.2.2)
 commonmark             1.8.1      2022-10-14 [1] CRAN (R 4.2.2)
 CompQuadForm           1.4.3      2017-04-12 [1] CRAN (R 4.2.0)
 cowplot                1.1.1      2020-12-30 [1] CRAN (R 4.2.2)
 coxphw               * 4.0.2      2020-06-22 [1] CRAN (R 4.2.2)
 crayon                 1.5.2      2022-09-29 [1] CRAN (R 4.2.2)
 data.table             1.14.10    2023-12-08 [1] CRAN (R 4.2.3)
 datawizard             0.9.0      2023-09-15 [1] CRAN (R 4.2.3)
 DBI                    1.1.3      2022-06-18 [1] CRAN (R 4.2.2)
 dbplyr                 2.2.1      2022-06-27 [1] CRAN (R 4.2.2)
 deldir                 1.0-6      2021-10-23 [1] CRAN (R 4.2.1)
 deSolve                1.34       2022-10-22 [1] CRAN (R 4.2.2)
 devtools               2.4.5      2022-10-11 [1] CRAN (R 4.2.2)
 digest                 0.6.30     2022-10-18 [1] CRAN (R 4.2.2)
 discSurv             * 2.0.0      2022-03-02 [1] CRAN (R 4.2.2)
 dplyr                * 1.0.10     2022-09-01 [1] CRAN (R 4.2.2)
 dynamichazard        * 1.0.2      2022-10-05 [1] CRAN (R 4.2.2)
 effects              * 4.2-2      2022-07-13 [1] CRAN (R 4.2.2)
 effectsize             0.8.6      2023-09-14 [1] CRAN (R 4.2.3)
 ellipsis               0.3.2      2021-04-29 [1] CRAN (R 4.2.2)
 emmeans              * 1.8.3      2022-12-06 [1] CRAN (R 4.2.2)
 estimability           1.4.1      2022-08-05 [1] CRAN (R 4.2.1)
 fansi                  1.0.3      2022-03-24 [1] CRAN (R 4.2.2)
 farver                 2.1.1      2022-07-06 [1] CRAN (R 4.2.2)
 fastmap                1.1.0      2021-01-25 [1] CRAN (R 4.2.2)
 fitdistrplus         * 1.1-8      2022-03-10 [1] CRAN (R 4.2.3)
 flexsurv             * 2.2.1      2022-12-22 [1] CRAN (R 4.2.2)
 forcats              * 0.5.2      2022-08-19 [1] CRAN (R 4.2.2)
 foreign                0.8-83     2022-09-28 [1] CRAN (R 4.2.2)
 Formula              * 1.2-4      2020-10-16 [1] CRAN (R 4.2.0)
 fs                     1.5.2      2021-12-08 [1] CRAN (R 4.2.2)
 FSA                  * 0.9.3      2022-02-18 [1] CRAN (R 4.2.2)
 functional             0.6        2014-07-16 [1] CRAN (R 4.2.0)
 gargle                 1.2.1      2022-09-08 [1] CRAN (R 4.2.2)
 geepack                1.3.9      2022-08-16 [1] CRAN (R 4.2.2)
 generics               0.1.3      2022-07-05 [1] CRAN (R 4.2.2)
 ggeffects              1.3.2      2023-10-17 [1] CRAN (R 4.2.3)
 ggplot2              * 3.4.0      2022-11-04 [1] CRAN (R 4.2.2)
 ggpubr               * 0.5.0.999  2022-11-30 [1] Github (kassambara/ggpubr@a95bc06)
 ggsignif               0.6.4      2022-10-13 [1] CRAN (R 4.2.2)
 ggtext                 0.1.2      2022-09-16 [1] CRAN (R 4.2.2)
 glue                   1.6.2      2022-02-24 [1] CRAN (R 4.2.2)
 googledrive            2.0.0      2021-07-08 [1] CRAN (R 4.2.2)
 googlesheets4          1.0.1      2022-08-13 [1] CRAN (R 4.2.2)
 gridExtra            * 2.3        2017-09-09 [1] CRAN (R 4.2.2)
 gridtext               0.1.5      2022-09-16 [1] CRAN (R 4.2.2)
 gtable                 0.3.1      2022-09-01 [1] CRAN (R 4.2.2)
 gvlma                * 1.0.0.3    2019-01-05 [1] CRAN (R 4.2.0)
 haven                  2.5.1      2022-08-22 [1] CRAN (R 4.2.2)
 Hmisc                * 4.7-2      2022-11-18 [1] CRAN (R 4.2.2)
 hms                    1.1.2      2022-08-19 [1] CRAN (R 4.2.2)
 htmlTable              2.4.1      2022-07-07 [1] CRAN (R 4.2.2)
 htmltools              0.5.3      2022-07-18 [1] CRAN (R 4.2.2)
 htmlwidgets            1.5.4      2021-09-08 [1] CRAN (R 4.2.2)
 httpuv                 1.6.6      2022-09-08 [1] CRAN (R 4.2.2)
 httr                   1.4.4      2022-08-17 [1] CRAN (R 4.2.2)
 insight                0.19.6     2023-10-12 [1] CRAN (R 4.2.3)
 interactions         * 1.1.5      2021-07-02 [1] CRAN (R 4.2.3)
 interp                 1.1-3      2022-07-13 [1] CRAN (R 4.2.2)
 jpeg                   0.1-10     2022-11-29 [1] CRAN (R 4.2.2)
 jsonlite               1.8.3      2022-10-21 [1] CRAN (R 4.2.2)
 jtools                 2.2.1      2022-12-02 [1] CRAN (R 4.2.2)
 Kendall                2.2.1      2022-03-20 [1] CRAN (R 4.2.3)
 km.ci                  0.5-6      2022-04-06 [1] CRAN (R 4.2.2)
 KMsurv                 0.1-5      2012-12-03 [1] CRAN (R 4.2.0)
 knitr                  1.41       2022-11-18 [1] CRAN (R 4.2.2)
 labeling               0.4.2      2020-10-20 [1] CRAN (R 4.2.0)
 later                  1.3.0      2021-08-18 [1] CRAN (R 4.2.2)
 lattice              * 0.20-45    2021-09-22 [1] CRAN (R 4.2.2)
 latticeExtra           0.6-30     2022-07-04 [1] CRAN (R 4.2.2)
 lavaan                 0.6-12     2022-07-04 [1] CRAN (R 4.2.2)
 lawstat              * 3.6        2023-04-05 [1] CRAN (R 4.2.3)
 libcoin                1.0-9      2021-09-27 [1] CRAN (R 4.2.2)
 lifecycle              1.0.3      2022-10-07 [1] CRAN (R 4.2.2)
 lme4                 * 1.1-31     2022-11-01 [1] CRAN (R 4.2.2)
 lmerTest             * 3.1-3      2020-10-23 [1] CRAN (R 4.2.2)
 lmtest               * 0.9-40     2022-03-21 [1] CRAN (R 4.2.2)
 lubridate              1.9.0      2022-11-06 [1] CRAN (R 4.2.2)
 magrittr               2.0.3      2022-03-30 [1] CRAN (R 4.2.2)
 markdown               1.4        2022-11-16 [1] CRAN (R 4.2.2)
 MASS                 * 7.3-58.1   2022-08-03 [1] CRAN (R 4.2.2)
 Matrix               * 1.5-1      2022-09-13 [1] CRAN (R 4.2.2)
 MatrixModels           0.5-1      2022-09-11 [1] CRAN (R 4.2.2)
 matrixStats            0.63.0     2022-11-18 [1] CRAN (R 4.2.2)
 memoise                2.0.1      2021-11-26 [1] CRAN (R 4.2.2)
 mgcv                   1.8-41     2022-10-21 [1] CRAN (R 4.2.2)
 mime                   0.12       2021-09-28 [1] CRAN (R 4.2.0)
 miniUI                 0.1.1.1    2018-05-18 [1] CRAN (R 4.2.2)
 minqa                  1.2.5      2022-10-19 [1] CRAN (R 4.2.2)
 mitools                2.4        2019-04-26 [1] CRAN (R 4.2.2)
 mnormt                 2.1.1      2022-09-26 [1] CRAN (R 4.2.1)
 modelr                 0.1.10     2022-11-11 [1] CRAN (R 4.2.2)
 modeltools             0.2-23     2020-03-05 [1] CRAN (R 4.2.0)
 mstate                 0.3.2      2021-11-08 [1] CRAN (R 4.2.2)
 muhaz                  1.2.6.4    2021-04-21 [1] CRAN (R 4.2.2)
 multcomp             * 1.4-20     2022-08-07 [1] CRAN (R 4.2.2)
 multcompView         * 0.1-8      2019-12-19 [1] CRAN (R 4.2.2)
 munsell                0.5.0      2018-06-12 [1] CRAN (R 4.2.2)
 mvnfast                0.2.7      2021-05-20 [1] CRAN (R 4.2.2)
 mvtnorm              * 1.1-3      2021-10-08 [1] CRAN (R 4.2.0)
 nlme                   3.1-160    2022-10-10 [1] CRAN (R 4.2.2)
 nloptr                 2.0.3      2022-05-26 [1] CRAN (R 4.2.2)
 nnet                   7.3-18     2022-09-28 [1] CRAN (R 4.2.2)
 nonnest2             * 0.5-5      2020-07-05 [1] CRAN (R 4.2.2)
 numDeriv               2016.8-1.1 2019-06-06 [1] CRAN (R 4.2.0)
 ordinal              * 2022.11-16 2022-11-16 [1] CRAN (R 4.2.2)
 overlapping          * 2.1        2022-12-14 [1] CRAN (R 4.2.2)
 pander                 0.6.5      2022-03-18 [1] CRAN (R 4.2.2)
 parameters             0.21.2     2023-09-16 [1] CRAN (R 4.2.3)
 pbivnorm               0.6.0      2015-01-23 [1] CRAN (R 4.2.0)
 pbkrtest               0.5.1      2021-03-09 [1] CRAN (R 4.2.2)
 performance            0.10.5     2023-09-12 [1] CRAN (R 4.2.3)
 pillar                 1.9.0      2023-03-22 [1] CRAN (R 4.2.3)
 pkgbuild               1.4.0      2022-11-27 [1] 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)
 png                    0.1-8      2022-11-29 [1] CRAN (R 4.2.2)
 polspline              1.1.22     2022-11-23 [1] CRAN (R 4.2.2)
 prettyunits            1.1.1      2020-01-24 [1] CRAN (R 4.2.2)
 processx               3.8.0      2022-10-26 [1] CRAN (R 4.2.2)
 profileModel         * 0.6.1      2021-01-08 [1] CRAN (R 4.2.3)
 profvis                0.3.7      2020-11-02 [1] CRAN (R 4.2.2)
 promises               1.2.0.1    2021-02-11 [1] CRAN (R 4.2.2)
 ps                     1.7.2      2022-10-26 [1] CRAN (R 4.2.2)
 purrr                * 1.0.2      2023-08-10 [1] CRAN (R 4.2.3)
 quadprog               1.5-8      2019-11-20 [1] CRAN (R 4.2.0)
 quantreg               5.94       2022-07-20 [1] CRAN (R 4.2.2)
 R6                     2.5.1      2021-08-19 [1] CRAN (R 4.2.2)
 ranger                 0.14.1     2022-06-18 [1] CRAN (R 4.2.2)
 rbibutils              2.2.11     2022-12-08 [1] CRAN (R 4.2.2)
 RColorBrewer           1.1-3      2022-04-03 [1] CRAN (R 4.2.0)
 Rcpp                   1.0.9      2022-07-08 [1] CRAN (R 4.2.2)
 Rdpack                 2.4        2022-07-20 [1] CRAN (R 4.2.2)
 readr                * 2.1.3      2022-10-01 [1] CRAN (R 4.2.2)
 readxl                 1.4.1      2022-08-17 [1] CRAN (R 4.2.2)
 remotes                2.4.2      2021-11-30 [1] CRAN (R 4.2.2)
 reprex                 2.0.2      2022-08-17 [1] CRAN (R 4.2.2)
 rlang                  1.1.2      2023-11-04 [1] CRAN (R 4.2.3)
 rms                  * 6.3-0      2022-04-22 [1] CRAN (R 4.2.2)
 rpart                * 4.1.19     2022-10-21 [1] CRAN (R 4.2.2)
 rstatix                0.7.1.999  2022-11-30 [1] Github (kassambara/rstatix@ed01c80)
 rstudioapi             0.14       2022-08-22 [1] CRAN (R 4.2.2)
 RVAideMemoire        * 0.9-81-2   2022-02-21 [1] CRAN (R 4.2.2)
 rvest                  1.0.3      2022-08-19 [1] CRAN (R 4.2.2)
 sandwich             * 3.0-2      2022-06-15 [1] CRAN (R 4.2.2)
 scales                 1.2.1      2022-08-20 [1] CRAN (R 4.2.2)
 sessioninfo            1.2.2      2021-12-06 [1] CRAN (R 4.2.2)
 sfsmisc              * 1.1-15     2023-04-20 [1] CRAN (R 4.2.3)
 shiny                  1.7.3      2022-10-25 [1] CRAN (R 4.2.2)
 sjlabelled             1.2.0      2022-04-10 [1] CRAN (R 4.2.3)
 sjmisc                 2.8.9      2021-12-03 [1] CRAN (R 4.2.3)
 sjPlot               * 2.8.15     2023-08-17 [1] CRAN (R 4.2.3)
 sjstats                0.18.2     2022-11-19 [1] CRAN (R 4.2.3)
 SparseM              * 1.81       2021-02-18 [1] CRAN (R 4.2.0)
 statmod                1.5.0      2023-01-06 [1] CRAN (R 4.2.2)
 stringi                1.7.8      2022-07-11 [1] CRAN (R 4.2.1)
 stringr              * 1.4.1.9000 2022-11-30 [1] Github (tidyverse/stringr@ebf3823)
 survey                 4.1-1      2021-07-19 [1] CRAN (R 4.2.2)
 survival             * 3.4-0      2022-08-09 [1] CRAN (R 4.2.2)
 survminer            * 0.4.9.999  2023-12-17 [1] Github (kassambara/survminer@64de674)
 survMisc               0.5.6      2022-04-07 [1] CRAN (R 4.2.2)
 survRM2              * 1.0-4      2022-06-14 [1] CRAN (R 4.2.2)
 testthat             * 3.1.5      2022-10-08 [1] CRAN (R 4.2.2)
 TH.data              * 1.1-1      2022-04-26 [1] CRAN (R 4.2.2)
 tibble               * 3.2.1      2023-03-20 [1] CRAN (R 4.2.3)
 tidyr                * 1.2.1.9001 2022-11-30 [1] Github (tidyverse/tidyr@21818c6)
 tidyselect             1.2.0      2022-10-10 [1] CRAN (R 4.2.2)
 tidyverse            * 1.3.2      2022-07-18 [1] CRAN (R 4.2.2)
 timechange             0.1.1      2022-11-04 [1] CRAN (R 4.2.2)
 tree                 * 1.0-43     2023-02-05 [1] CRAN (R 4.2.3)
 treeClust            * 1.1-7      2018-05-12 [1] CRAN (R 4.2.2)
 tzdb                   0.3.0      2022-03-28 [1] CRAN (R 4.2.2)
 ucminf                 1.1-4.1    2022-09-29 [1] CRAN (R 4.2.1)
 urlchecker             1.0.1      2021-11-30 [1] CRAN (R 4.2.2)
 usethis                2.1.6      2022-05-25 [1] CRAN (R 4.2.2)
 utf8                   1.2.2      2021-07-24 [1] CRAN (R 4.2.2)
 vctrs                  0.6.4      2023-10-12 [1] CRAN (R 4.2.3)
 VGAM                   1.1-7      2022-07-06 [1] CRAN (R 4.2.2)
 viridisLite            0.4.1      2022-08-22 [1] CRAN (R 4.2.2)
 withr                  2.5.0      2022-03-03 [1] CRAN (R 4.2.2)
 xfun                   0.35       2022-11-16 [1] CRAN (R 4.2.2)
 xml2                   1.3.3      2021-11-30 [1] CRAN (R 4.2.2)
 xtable                 1.8-4      2019-04-21 [1] CRAN (R 4.2.2)
 zoo                  * 1.8-11     2022-09-17 [1] CRAN (R 4.2.2)
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

1 participant