I am not aware of any predefined function that does what you are looking for, but you can hack together a solution for it fairly easily. It might not qualify as simple, but it does get the job done efficiently.
attach(fit)
n <- max(strata)
rbindlist(mapply(function(st, su){
data.table(strata = rep(st, n),
surv = c(su, rep(NA, n - length(su))))
}, names(strata), split(surv, rep(names(strata), strata)), SIMPLIFY=FALSE))
Basically what it does is to split the values of surv
into separate vectors based on strata
, then make a data.table for each with a fixed number of n
rows, and finally stacks them all together with rbindlist.
strata surv
1: A 1
2: A 2
3: A 3
4: A 4
5: A 5
6: B 6
7: B 7
8: B 8
9: B NA
10: B NA
11: C 9
12: C 10
13: C NA
14: C NA
15: C NA