survminer
survminer copied to clipboard
ggsurvplot cumevents decimal places / digits when using weights
I use weights on my survfit function. I want to plot in the risk table also the cumulative events, but unfortunately it produces very long numbers with a lot of decimal digits. Is there anyway to control for the cumevents digits? The problem doesn't happen if I don't use weights.
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).
@MaverickMeerkat
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)