I am new to survival analysis and survfit in R. I want to extract survival probabilities for 4 groups (diseases) at specified time periods (0,10,20,30 years since diagnosis) in a table. Here is the setup:
fit <- survfit((time=time,event=death)~group)
surv.prob <- summary(fit,time=c(0,10,20,30))$surv
surv.prob
contains 16 probabilities, that is, survival probabilities for 4 groups estimated at 4 different time periods listed above. I want to create a table like this:
Group time.period prob
1 0 0.9
1 10 0.8
1 20 0.7
1 30 0.6
and so on for all 4 groups.
Any suggestions on how a table like this can be easily created? I will be putting this command in loop to estimate results using different combinations of covariates. I looked at $table in survfit but that seems to only provide events, median etc. Appreciate any help on this.
SK