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

Cumulative event number in risk table #117

Closed
kassambara opened this issue Jan 22, 2017 · 4 comments
Closed

Cumulative event number in risk table #117

kassambara opened this issue Jan 22, 2017 · 4 comments

Comments

@kassambara
Copy link
Owner

@kassambara kassambara commented Jan 22, 2017

(user request by e-mail)

Would you add number of cumulative event under number at risk in each strata?

@kassambara
Copy link
Owner Author

@kassambara kassambara commented Feb 26, 2017

Another e-mail from a survminer user

First, thank you very much for creating survminer. After having it recommended by a friend, we've used it to create Kaplan-Meiers for a number of pending article submissions and upcoming meeting presentations.

We have received feedback from reviewers that they would not only like to see the Risk Table (Number at Risk), but also the Cumulative Number of Events. Not finding a ready solution, we manually calculated, and added the information in an image editor per the reviewers / editor's wishes (please see attached image).

Do you have recommendations as how to add such information in a less laborious manner? Do you foresee adding such a table as a future feature for the survminer package? We'd have immediate use for it!

survminer_numberevents

@kassambara
Copy link
Owner Author

@kassambara kassambara commented Feb 26, 2017

I'm working on this

kassambara added a commit that referenced this issue Feb 26, 2017
@kassambara
Copy link
Owner Author

@kassambara kassambara commented Feb 26, 2017

A first attempt:

library(survival)
fit<- survfit(Surv(time, status) ~ sex, data = lung)

library(survminer)
ggsurvplot(fit, data = lung, risk.table = TRUE, cumevents = TRUE,
           risk.table.title = "No. at Risk",
           cumevents.title = "Cumulative No. of Events",
           risk.table.y.text = FALSE,
           cumevents.y.text = FALSE,
           ggtheme = theme_light())

rplot

kassambara added a commit that referenced this issue Feb 26, 2017
@kassambara
Copy link
Owner Author

@kassambara kassambara commented Feb 26, 2017

Creating easily clean tables:

  • clean risk tables
  • clean cumulative number of events table
# Fit survival curves
library(survival)
fit<- survfit(Surv(time, status) ~ sex, data = lung)

# Plotting the survival curves
library(survminer)
ggsurv <- ggsurvplot(fit, data = lung, risk.table = TRUE, cumevents = TRUE,
                     pval = TRUE,
                     risk.table.title = "No. at Risk",
                     cumevents.title = "Cumulative No. of Events",
                     risk.table.height = 0.15, cumevents.height = 0.15,
                     risk.table.y.text = FALSE,
                     cumevents.y.text = FALSE
                 )


# Customizing tables and print
ggsurv$table <- ggsurv$table + theme_cleantable()
ggsurv$cumevents <- ggsurv$cumevents + theme_cleantable()

# print
ggsurv

rplot02

kassambara added a commit that referenced this issue Feb 26, 2017
kassambara added a commit that referenced this issue Feb 27, 2017
@kassambara kassambara closed this Feb 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.