0

I am using the cmprsk package in R to generate some competing risks analysis.

Currently I am trying to plot them using 'ggcompetingrisks', but have no idea how to generate two separate plots for the two events here. Any help is appreciated.

Code for plotting:

fit <- cuminc(leuk$censor_time, leuk$competing_risk, group = leuk$group)
ggcompetingrisks(fit)
p <- ggcompetingrisks(fit, multiple_panels = F,
                  title = "Competing Risks Analysis") + scale_linetype_manual(name="Competing Events",values=c(1, 2),labels=c("TRM","Relapse")) + scale_color_discrete(labels = c(A = "low", B = "med", C = "high")) +  scale_color_manual(values = c("black", "orange","blue"))

p$mapping <- aes(x = time, y = est, colour = group, linetype = event)
p + labs(linetype = "event", colour = "my group")
Donniq
  • 11
  • 2
  • Please create a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example), otherwise it will be difficult for us to help you. – DaveArmstrong May 04 '23 at 20:00
  • Sorry about that, I've updated my code for plotting above. However, I've found a hack to somehow achieve that: changing the color for one group to white, and repeating for the other, which I know is not ideal but gets the job done. – Donniq May 04 '23 at 22:06

0 Answers0