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

Round the weighted survival estimates in the risk table #214

Closed
josephuses opened this issue May 15, 2017 · 5 comments
Closed

Round the weighted survival estimates in the risk table #214

josephuses opened this issue May 15, 2017 · 5 comments

Comments

@josephuses
Copy link

I was trying to reproduce the plot in p. 311 of Berglund, Heeringa, and West's Applied Survey Data Analysis. The data is available online at their website, which I linked here. How can I round off the survival estimates in the risk table? Can we have something like risk.table.decimal.place which defaults to a whole number?

library(tidyverse)
library(survival)
library(survminer)
ncsr <- read_sas("~/ncsr_analysis_ex_c1_c10_2011.sas7bdat")
colnames(ncsr) <- tolower(names(ncsr))
fit <- survfit(Surv(ageonsetmde,mde)~racecat, data = ncsr, weights = ncsrwtsh)
ggsurvplot(fit, data = ncsr, 
           ggtheme = theme_bw(), 
           linetype = "strata", 
           risk.table = TRUE, 
           risk.table.col = "strata", 
           legend.labs = c("Other", "Hispanic", "Black", "White"), 
           risk.table.fontsize = 2.75, 
           risk.table.height = 0.275, 
           break.time.by = 20, risk.table.y.text.col = T, 
           risk.table.y.text = FALSE) 

survival

@kassambara
Copy link
Owner

Would you please give the direct link to the "ncsr_analysis_ex_c1_c10_2011.sas7bdat" file, so that we can reproduce your example...

Thanks!

@kassambara
Copy link
Owner

Ok, I can found the data in a different post: #215

kassambara added a commit that referenced this issue May 15, 2017
kassambara added a commit that referenced this issue May 15, 2017
@kassambara
Copy link
Owner

Thank you or pointing this out.

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

@josephuses
Copy link
Author

Thank you! This solves my issue for this particular case. However, note that setting decimal.place to any other whole number does not give the desired number of decimal places.

@kassambara
Copy link
Owner

This option is not externaly available. The default is to systematically round the number at risk.

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

2 participants