0

I downloaded the "cmprsk" package and the "Cumincidence.R" (http://www.stat.unipg.it/luca/misc/CumIncidence.R) in order to create cumulative incidence plots.

This worked out fine. I used these commands:

status=factor(status, levels=c(0:2), labels=c("censored", "TRM", "REL"))
abc=factor(abc, levels=c(0,1), labels=c("A", "B"))
fit=CumIncidence(ftime, status, abc, cencode= "censored", xlab = "years")

and I receive the plot attached.

enter image description here

But how can I only display the plots of "TRM" or of "REL", so only the red ones or only the black ones and not all together?

Thank you for your help!

  • 1
    Could you make your problem reproducible by sharing a sample of your data so others can help (please do not use `str()`, `head()` or screenshot)? You can use the [`reprex`](https://reprex.tidyverse.org/articles/articles/magic-reprex.html) and [`datapasta`](https://cran.r-project.org/web/packages/datapasta/vignettes/how-to-datapasta.html) packages to assist you with that. See also [Help me Help you](https://speakerdeck.com/jennybc/reprex-help-me-help-you?slide=5) & [How to make a great R reproducible example?](https://stackoverflow.com/q/5963269) – Tung Dec 02 '18 at 10:19
  • Sorry, I forgot to attach my data. Unfortunately I didnt manage the copy with reprex, I am sorry for it. But here is my .csv file uploaded:https://transferxl.com/08j1MqQyqHXsxj – Alexander-P Dec 02 '18 at 10:57

1 Answers1

0

I made an improvement.
By using the term lty = c(0, 0, 1, 2), the plots dissapear. But unfortunately the description is still in the legend. Does anyone have an idea how to remove it?

  • ciao Alexander you can edit/update your question with an update section instead of putting this in an answer, it could be downvoted – Antonino Dec 29 '18 at 02:22