Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ggsurvfit::ggcuminc - customized statistics with risktable_stats not working #190

Closed
devanto86 opened this issue Feb 12, 2024 · 1 comment

Comments

@devanto86
Copy link

I'm trying to plot cumulative incidence curves for a competing risk scenario with ggsurvfit::ggcuminc. I'd like to add a risk table, customized to show n.risk and cum.event in the same line (not different line), as explained in the vignette https://www.danieldsjoberg.com/ggsurvfit/reference/add_risktable.html#ref-examples (see third example).

set.seed(1)
summary(time <- rnorm(200, 50, 10))
summary(event <- factor(sample(0:2, 200, replace = TRUE, prob = c(.4,.5,.1)), levels = 0:2, labels = c("censor", "event", "comp.event")))
table(female <- sample(0:1, 200, replace = TRUE), useNA = "ifany")
data <- tibble(time, event, female)

tidycmprsk::cuminc(Surv(time, event)~female, data=data) %>% 
  ggcuminc(outcome = "event") + add_risktable(risktable_stats = "{n.risk} ({cum.event})")

However, i always get this error

Error in match.arg(rev(risktable_stats), choices = c("n.risk", "cum.censor", : 'arg' should be one of “n.risk”, “cum.censor”, “cum.event”, “n.censor”, “n.event”

Can you help in understanding why this is not working, as shown in the vignette?

https://stackoverflow.com/questions/77981972/ggsurvfitggcuminc-customized-statistics-with-risktable-stats-not-working

@ddsjoberg
Copy link
Collaborator

Hi @devanto86 , stackoverflow.com is indeed the correct place to ask questions about the package. Thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants