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

Multiple reference levels when not including parameter "data" with ggforext() #626

Open
mknafl-mda opened this issue May 25, 2023 · 1 comment

Comments

@mknafl-mda
Copy link

Expected behavior

Every categorical level should have one reference level for a cox's regression

Actual behavior

In the forest plot, there are multiple reference levels

Steps to reproduce the problem

library(survival)
library(survminer)

require("survival")
model <- coxph( Surv(time, status) ~ sex + rx + adhere,
            data = colon )
ggforest(model)

colon <- within(colon, {
sex <- factor(sex, labels = c("female", "male"))
differ <- factor(differ, labels = c("well", "moderate", "poor"))
extent <- factor(extent, labels = c("submuc.", "muscle", "serosa", "contig."))
})
bigmodel <-
coxph(Surv(time, status) ~ sex + rx + adhere + differ + extent + node4,
        data = colon )
p <- ggforest(bigmodel)
print(p)

session_info()

R version 3.5.1 (2018-07-02)
Platform: x86_64-conda_cos6-linux-gnu (64-bit)
Running under: Ubuntu 20.04.6 LTS

Matrix products: default
BLAS: /opt/spark/work-dir/environment/lib/R/lib/libRblas.so
LAPACK: /opt/spark/work-dir/environment/lib/R/lib/libRlapack.so

locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
[4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
[7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] RCurl_1.98-1.2 dplyr_0.8.5 survminer_0.4.6
[4] ggpubr_0.2.5 magrittr_2.0.3 ggplot2_3.3.0
[7] survival_3.1-12 arrow_3.0.0 evaluate_0.14
[10] uuid_0.1-4 FoundrySparkR_0.2.0 SparkR_3.2.1
[13] vector_0.0.2 jsonlite_1.6.1 futile.logger_1.4.3

loaded via a namespace (and not attached):
[1] zoo_1.8-7 tidyselect_1.1.2 xfun_0.33
[4] purrr_0.3.4 splines_3.5.1 lattice_0.20-41
[7] colorspace_1.4-1 vctrs_0.4.1 generics_0.0.2
[10] survMisc_0.5.5 rlang_1.0.6 pillar_1.4.3
[13] glue_1.6.2 withr_2.2.0 bit64_0.9-7
[16] lambda.r_1.2.4 lifecycle_0.2.0 munsell_0.5.0
[19] ggsignif_0.6.0 gtable_0.3.0 labeling_0.3
[22] knitr_1.28 broom_0.5.6 Rcpp_1.0.6
[25] xtable_1.8-4 scales_1.1.0 backports_1.2.1
[28] formatR_1.7 farver_2.0.3 km.ci_0.5-2
[31] bit_1.1-15.2 gridExtra_2.3 digest_0.6.25
[34] KMsurv_0.1-5 cowplot_1.0.0 grid_3.5.1
[37] bitops_1.0-6 cli_3.4.1 tools_3.5.1
[40] tibble_3.0.1 futile.options_1.0.1 crayon_1.3.4
[43] tidyr_1.0.2 pkgconfig_2.0.3 ellipsis_0.3.0
[46] Matrix_1.2-18 data.table_1.12.8 assertthat_0.2.1
[49] R6_2.4.1 nlme_3.1-147 compiler_3.5.1

# please paste here the result of
devtools::session_info()
@mknafl-mda
Copy link
Author

multiple_reference_levels

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