kassambara / survminer

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

round the weighted survival estimates in the cumulative number of event table #560

Open siyunyang opened 3 years ago

siyunyang commented 3 years ago

I found a similar problem to this post. The digits = 0 option only round the number at risk, but not the cumulative number of events.

Thank you or pointing this out.

Now, the default behaviour of ggsurvplot() is to round the number at risk using the option digits = 0

Originally posted by @kassambara in https://github.com/kassambara/survminer/issues/214#issuecomment-301418865

ningyile commented 2 years ago

How to linstall

install.packages("devtools")
devtools::install_github('ningyile/survminer')

https://github.com/ningyile/survminer

Features

In theutilities.R, the cum.n.event and cum.n.censor was not rounded like other functions(such as n.risk, n.event, etc.). So I just fix the issue of [ggsurvplot cumevents decimal places / digits when using weights](https://github.com/kassambara/survminer/issues/554) by round the cumulative number of event( namely cum.n.event ) and censoring( namely cum.n.censor ) in weighted survival estimates(such as inverse-probability weight, IPW).

@siyunyang

shengchaohou commented 8 months ago

For now, you can manually edit the table by editing the ggsurvplot object.

ggsurv <- ggsurvplot(fit, data) ggsurv$cumevents$layers[[1]]$data$cum.n.event <-round(ggsurv$cumevents$layers[[1]]$data$cum.n.event)