NOTE: I changes my data to a publically avaliable data set. Therefore, restricting this dataset to 24 months might not make sense.
Dear R community,
I have some troubles fitting the x axis in a cumulative incidence curve. I tried to scale it setting ticks every 6 (months) starting from 0 - 24 months. Therefore, I used ggcompetingrisk from ggplot2, since it creates better figrues than solely the cmprsk package.
However, using this code (which I have adopted from various internet pages), I can only adopt the y axis, but not the x axis. Can you help me find the mistake?
library(cmprsk)
library(ggplot2)
library(survminer)
my.data <- survminer::BMT
attach <- my.data
p <-ggcompetingrisks(fit=cuminc(my.data$ftime,my.data$status,my.data$dis),
multiple_panels = FALSE,main="", xlab="Time (months)", ylab="Cumulative incidence (%)") +
scale_color_manual(name="",values=c("black","peru"), labels=c("Transplantation", "Death"))
ggpar(p,ylim=c(0,1),yticks.by=0.2,xlim=c(0,24),xticks.by=6)
Additionally, I am trying to place a table with "numbers at risk" below the cumulative incidence curve. It should look similar to this example and the usual layout of survival curves (http://forum.r-statistik.de/viewtopic.php?f=8&t=2153&p=10588&hilit=survminer#p10588).
I tried to use ggparagraph and ggarange, however, I cannot manage to place the respective numbers directly below each other
text <-paste("Cumulative 6 12 18 24\n
Incidence 6 12 18 24")
text.paragraph <- ggparagraph(text, lineheight = 0.4)
ggarrange(p, text.paragraph, heights = c(10, 1.8),ncol = 1, nrow = 2)
Do you have an idea how to solve this in a reasonable way?
Thanks a lot!