Data: There are other covariates aswell but these are the 3 main variables. I have changed pdc_80_v0 to factor
death_fu_time_18m | DeathFlag_18m | pdc_80_v0 |
---|---|---|
500 | 0 | 1 |
200 | 1 | 0 |
450 | 0 | 1 |
390 | 1 | 1 |
420 | 1 | 0 |
200 | 0 | 1 |
km_treat_t1 <- survfit(Surv(time = death_futime_18m, event = DeathFlag_18m) ~ pdc_80_v0,
data = cgm_t1_excl_upd %>% filter(.imp == 1),
#type = 'kaplan-meier',
ctype = 1, stype = 1)
#survival times, every 90 days
summary(km_treat_t1, times = c(seq(1, 548, by = 90)))
#plot
plot(km_treat_t1)
This code runs properly but is not much descriptive ggsurvplot(km_treat_t1, conf.int = 'True', risk.table = T, ylim = c(0.80, 1.0)) For this I am getting error that says error in data frame, argument implies differing number of rows 419, 0, 838
Code tried: Initially I got error in the survfit function for type = kapla-meier and hence changed the argument to ctype and stype