Error with ggsurvplot function for survival analysis
0
0
Entering edit mode
4.7 years ago
reui879 ▴ 10

I'm trying to make a KM plot using ggsurvplot but I'm getting an error.

fit <- survfit(Surv(Months, progression) ~ group, data=new)

ggsurvplot(fit,
           data = new,
           risk.table = TRUE,
           pval = TRUE,
           break.time.by = 500,
           ggtheme = theme_minimal(),
           risk.table.y.text.col = TRUE,
           risk.table.y.text = FALSE)

Error in as.data.frame.default(x[[i]], optional = TRUE) : cannot coerce class ‘"by"’ to a data.frame

Here's an example of my data:

Months  group  progression
 53      low    0
 34      low    0
 55      low    0
 36      low    0
 54      low    0
 54      low    0
 46      low    0
 88      low    1
 12      high   0
 43      high   0
 32      high   1
 23      high   1
 24      high   1
 64      high   1
 73      high   1
 24      high   1
 54      high   0
software error • 2.0k views
ADD COMMENT
0
Entering edit mode

Please hightlight code and data examples with the code option. That makes the most visually more appealing.

enter image description here

ADD REPLY

Login before adding your answer.

Traffic: 2323 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6