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

ggsurvplot_facet() says it supports numeric/text input to pval argument, but it doesn't. #636

Open
DesiQuintans opened this issue Dec 19, 2023 · 0 comments

Comments

@DesiQuintans
Copy link

Expected behavior

The docs for the pval argument in ggsurvplot_facet() are copy-pasted from ggsurvplot(). They say:

pval: logical value, a numeric or a string. If logical and TRUE, the p-value is added on the plot. If numeric, than the computet p-value is substituted with the one passed with this parameter. If character, then the customized string appears on the plot. See examples - Example 3.

This suggests that giving a vector of new values will insert those values in each facet.

Actual behavior/steps to reproduce

library(survival)
library(survminer)
#> Loading required package: ggplot2
#> Loading required package: ggpubr
#> 
#> Attaching package: 'survminer'
#> The following object is masked from 'package:survival':
#> 
#>     myeloma

# Facet by one grouping variables: rx
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::
fit <- survfit( Surv(time, status) ~ sex, data = colon )
ggsurvplot_facet(fit, colon, facet.by = "rx",
                palette = "jco", pval = TRUE)
#> Warning: `as.tibble()` was deprecated in tibble 2.0.0.
#> ℹ Please use `as_tibble()` instead.
#> ℹ The signature and semantics have changed, see `?as_tibble`.
#> ℹ The deprecated feature was likely used in the survminer package.
#>   Please report the issue at <https://github.com/kassambara/survminer/issues>.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
#> Warning: `select_()` was deprecated in dplyr 0.7.0.
#> ℹ Please use `select()` instead.
#> ℹ The deprecated feature was likely used in the survminer package.
#>   Please report the issue at <https://github.com/kassambara/survminer/issues>.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.

# Facet by two grouping variables: rx and adhere
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::
ggsurvplot_facet(fit, colon, facet.by = c("rx", "adhere"),
                palette = "jco", pval = 0.34534)

# Another fit
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::
fit2 <- survfit( Surv(time, status) ~ sex + rx, data = colon )
ggsurvplot_facet(fit2, colon, facet.by = "adhere",
                palette = "jco", pval = "test")
#> Error in if (pval) {: argument is not interpretable as logical

Created on 2023-12-19 with reprex v2.0.2

session_info()

# please paste here the result of
─ Session info ──────────────────────────────────────────────────────
 setting  value
 version  R version 4.3.2 (2023-10-31 ucrt)
 os       Windows 11 x64 (build 22621)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  English_Australia.utf8
 ctype    English_Australia.utf8
 tz       Australia/Sydney
 date     2023-12-19
 rstudio  2023.09.0+463 Desert Sunflower (desktop)
 pandoc   3.1.1 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)

─ Packages ──────────────────────────────────────────────────────────
 package     * version   date (UTC) lib source
 abind         1.4-5     2016-07-21 [1] CRAN (R 4.3.0)
 backports     1.4.1     2021-12-13 [1] CRAN (R 4.3.0)
 broom         1.0.5     2023-06-09 [1] CRAN (R 4.3.1)
 cachem        1.0.8     2023-05-01 [1] CRAN (R 4.3.0)
 callr         3.7.3     2022-11-02 [1] CRAN (R 4.3.0)
 car           3.1-2     2023-03-30 [1] CRAN (R 4.3.0)
 carData       3.0-5     2022-01-06 [1] CRAN (R 4.3.0)
 cli           3.6.2     2023-12-11 [1] CRAN (R 4.3.2)
 clipr         0.8.0     2022-02-22 [1] CRAN (R 4.3.1)
 colorspace    2.1-0     2023-01-23 [1] CRAN (R 4.3.0)
 commonmark    1.9.0     2023-03-17 [1] CRAN (R 4.3.0)
 crayon        1.5.2     2022-09-29 [1] CRAN (R 4.3.0)
 curl          5.1.0     2023-10-02 [1] CRAN (R 4.3.2)
 data.table    1.14.10   2023-12-08 [1] CRAN (R 4.3.2)
 desc          1.4.3     2023-12-10 [1] CRAN (R 4.3.2)
 devtools      2.4.5     2022-10-11 [1] CRAN (R 4.3.0)
 digest        0.6.33    2023-07-07 [1] CRAN (R 4.3.1)
 dplyr         1.1.4     2023-11-17 [1] CRAN (R 4.3.2)
 ellipsis      0.3.2     2021-04-29 [1] CRAN (R 4.3.0)
 evaluate      0.23      2023-11-01 [1] CRAN (R 4.3.2)
 fansi         1.0.6     2023-12-08 [1] CRAN (R 4.3.2)
 farver        2.1.1     2022-07-06 [1] CRAN (R 4.3.0)
 fastmap       1.1.1     2023-02-24 [1] CRAN (R 4.3.0)
 fs            1.6.3     2023-07-20 [1] CRAN (R 4.3.1)
 generics      0.1.3     2022-07-05 [1] CRAN (R 4.3.0)
 ggplot2     * 3.4.4     2023-10-12 [1] CRAN (R 4.3.1)
 ggpubr      * 0.6.0     2023-02-10 [1] CRAN (R 4.3.1)
 ggsci         3.0.0     2023-03-08 [1] CRAN (R 4.3.1)
 ggsignif      0.6.4     2022-10-13 [1] CRAN (R 4.3.1)
 ggtext        0.1.2     2022-09-16 [1] CRAN (R 4.3.2)
 glue          1.6.2     2022-02-24 [1] CRAN (R 4.3.0)
 gridExtra     2.3       2017-09-09 [1] CRAN (R 4.3.0)
 gridtext      0.1.5     2022-09-16 [1] CRAN (R 4.3.2)
 gtable        0.3.4     2023-08-21 [1] CRAN (R 4.3.1)
 htmltools     0.5.7     2023-11-03 [1] CRAN (R 4.3.2)
 htmlwidgets   1.6.3     2023-11-22 [1] CRAN (R 4.3.2)
 httpuv        1.6.12    2023-10-23 [1] CRAN (R 4.3.2)
 km.ci         0.5-6     2022-04-06 [1] CRAN (R 4.3.2)
 KMsurv        0.1-5     2012-12-03 [1] CRAN (R 4.3.1)
 knitr         1.45      2023-10-30 [1] CRAN (R 4.3.2)
 labeling      0.4.3     2023-08-29 [1] CRAN (R 4.3.1)
 later         1.3.1     2023-05-02 [1] CRAN (R 4.3.0)
 lattice       0.22-5    2023-10-24 [2] CRAN (R 4.3.2)
 lifecycle     1.0.4     2023-11-07 [1] CRAN (R 4.3.2)
 magrittr      2.0.3     2022-03-30 [1] CRAN (R 4.3.0)
 markdown      1.12      2023-12-06 [1] CRAN (R 4.3.2)
 Matrix        1.6-3     2023-11-14 [1] CRAN (R 4.3.2)
 memoise       2.0.1     2021-11-26 [1] CRAN (R 4.3.0)
 mime          0.12      2021-09-28 [1] CRAN (R 4.3.0)
 miniUI        0.1.1.1   2018-05-18 [1] CRAN (R 4.3.0)
 munsell       0.5.0     2018-06-12 [1] CRAN (R 4.3.0)
 pillar        1.9.0     2023-03-22 [1] CRAN (R 4.3.0)
 pkgbuild      1.4.3     2023-12-10 [1] CRAN (R 4.3.2)
 pkgconfig     2.0.3     2019-09-22 [1] CRAN (R 4.3.0)
 pkgload       1.3.3     2023-09-22 [1] CRAN (R 4.3.2)
 processx      3.8.3     2023-12-10 [1] CRAN (R 4.3.2)
 profvis       0.3.8     2023-05-02 [1] CRAN (R 4.3.0)
 promises      1.2.1     2023-08-10 [1] CRAN (R 4.3.2)
 ps            1.7.5     2023-04-18 [1] CRAN (R 4.3.0)
 purrr         1.0.2     2023-08-10 [1] CRAN (R 4.3.1)
 R.cache       0.16.0    2022-07-21 [1] CRAN (R 4.3.0)
 R.methodsS3   1.8.2     2022-06-13 [1] CRAN (R 4.3.0)
 R.oo          1.25.0    2022-06-12 [1] CRAN (R 4.3.0)
 R.utils       2.12.3    2023-11-18 [1] CRAN (R 4.3.2)
 R6            2.5.1     2021-08-19 [1] CRAN (R 4.3.0)
 ragg          1.2.7     2023-12-11 [1] CRAN (R 4.3.2)
 Rcpp          1.0.11    2023-07-06 [1] CRAN (R 4.3.1)
 remotes       2.4.2.1   2023-07-18 [1] CRAN (R 4.3.1)
 reprex        2.0.2     2022-08-17 [1] CRAN (R 4.3.0)
 rlang         1.1.2     2023-11-04 [1] CRAN (R 4.3.2)
 rmarkdown     2.25      2023-09-18 [1] CRAN (R 4.3.2)
 rstatix       0.7.2     2023-02-01 [1] CRAN (R 4.3.1)
 rstudioapi    0.15.0    2023-07-07 [1] CRAN (R 4.3.1)
 scales        1.3.0     2023-11-28 [1] CRAN (R 4.3.1)
 sessioninfo   1.2.2     2021-12-06 [1] CRAN (R 4.3.0)
 shiny         1.8.0     2023-11-17 [1] CRAN (R 4.3.2)
 stringi       1.8.3     2023-12-11 [1] CRAN (R 4.3.2)
 stringr       1.5.1     2023-11-14 [1] CRAN (R 4.3.2)
 styler        1.10.2    2023-08-29 [1] CRAN (R 4.3.2)
 survival    * 3.5-7     2023-08-14 [2] CRAN (R 4.3.2)
 survminer   * 0.4.9.999 2023-12-19 [1] Github (kassambara/survminer@64de674)
 survMisc      0.5.6     2022-04-07 [1] CRAN (R 4.3.2)
 systemfonts   1.0.5     2023-10-09 [1] CRAN (R 4.3.1)
 textshaping   0.3.7     2023-10-09 [1] CRAN (R 4.3.2)
 tibble        3.2.1     2023-03-20 [1] CRAN (R 4.3.0)
 tidyr         1.3.0     2023-01-24 [1] CRAN (R 4.3.0)
 tidyselect    1.2.0     2022-10-10 [1] CRAN (R 4.3.0)
 urlchecker    1.0.1     2021-11-30 [1] CRAN (R 4.3.0)
 usethis       2.2.2     2023-07-06 [1] CRAN (R 4.3.1)
 utf8          1.2.4     2023-10-22 [1] CRAN (R 4.3.2)
 vctrs         0.6.5     2023-12-01 [1] CRAN (R 4.3.2)
 withr         2.5.2     2023-10-30 [1] CRAN (R 4.3.2)
 xfun          0.41      2023-11-01 [1] CRAN (R 4.3.2)
 xml2          1.3.6     2023-12-04 [1] CRAN (R 4.3.2)
 xtable        1.8-4     2019-04-21 [1] CRAN (R 4.3.0)
 yaml          2.3.8     2023-12-11 [1] CRAN (R 4.3.2)
 zoo           1.8-12    2023-04-13 [1] CRAN (R 4.3.0)

 [1] C:/Users/dqui6184/AppData/Local/R/win-library/4.3
 [2] C:/Program Files/R/R-4.3.2/library

─────────────────────────────────────────────────────────────────────
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