R - Problem with risk table in a Kaplan-Meier plot

 
Vista:

Problem with risk table in a Kaplan-Meier plot

Publicado por Roberto (1 intervención) el 21/09/2021 23:57:06
Hi everybody!
It is my first time here and I wish to as clear and kind as every user in this forum.
I am trying to generate a Kaplan-Meier Plot for Overall Survival using survival and ggplot2 packages, with the data contained in data1. OS variable codifies time variable and Exitus variable codifies the events.
The plot is generated correctly but when I used the option risk.table=TRUE, the number of patients at risk at time=0 is missing. I always used this code in order to generate Kaplan-Meier plots and I have never had this kind of problem
Any advice will be welcome
Next, I share mi data and my code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
data1 <- data.frame("Subject"=1:46,
                    "Exitus"=c(0,0,1,1,0,1,0,1,0,0,0,1,0,1,0,0,1,
                               0,0,0,0,1,0,0,0,0,1,1,0,1,0,1,0,0,
                               1,0,0,1,0,0,0,1,0,0,0,1),
                    "OS"=c(40.7,40,44,40,45,38.6,38,37,39,42,37,
                                       40.7,40,22,35,40,20,32.7,34.3,34.6,35.4,
                                       17,37,35,30,31,26,30.7,37,20,31,25,37,
                                       31,33,29.5,30.1,7.9,29.2,29.1,34,35,31,
                                       30,32,7))
library(survival)
library(ggplot2)
library(survminer)
 
##Global OS
fit_OS<- survfit(Surv(OS, Exitus) ~ 1, data = data1)
ggsurvplot(fit_OS)
KM_OS<-ggsurvplot(fit_OS, title="OS", legend = "bottom",
                  legend.title = "OS",
                  risk.table = TRUE,
                  risk.table.col = "black",
                  ggtheme = theme_bw(),
                  palette = c("#FAD234"),
                  tables.height = 0.15,
                  tables.theme = theme_cleantable(),
                  tables.y.text = FALSE
)
KM_OS$plot<-KM_OS$plot + xlab("Time (months)")
print(KM_OS)
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder