kassambara / survminer

Survival Analysis and Visualization
https://rpkgs.datanovia.com/survminer/
495 stars 160 forks source link

can't plot variables specified in `var` argument in ggcoxzph #75

Closed MarcinKosinski closed 7 years ago

MarcinKosinski commented 7 years ago

User private e-mail

Can you provide an example of how to use the var argument in ggcoxzph? I only want to print a plot for specific variables.

Thank you,

Mason Burley

I'll answer in a second.

MarcinKosinski commented 7 years ago

Mason,

This will be possible after merging this pull request https://github.com/kassambara/survminer/pull/76

An example on how to use the var argument in ggcoxzph

library(survival)
fit <- coxph(Surv(futime, fustat) ~ age + ecog.ps + rx, data=ovarian)
cox.zph.fit <- cox.zph(fit)
library(survminer)
ggcoxzph(cox.zph.fit) 

unnamed-chunk-1-1

# change the plots order
ggcoxzph(cox.zph.fit, var = c("ecog.ps", "rx", "age"))

unnamed-chunk-1-2

# plot only specified vairables
ggcoxzph(cox.zph.fit, var = c("ecog.ps", "rx"))

unnamed-chunk-1-3

Thanks for reporting this issue. Till that time you can install survminer from my fork

devtools::install_github('MarcinKosinski/survminer')
kassambara commented 7 years ago

pull request merged now:-)!

MarcinKosinski commented 7 years ago

That works great now! Thanks for responding so quickly

Mason Burley