Closed ThomasSoeiro closed 1 week ago
Hi @terrytangyuan, Do you confirm the issue? Would you consider a patch based on what I proposed in https://github.com/sinhrks/ggfortify/issues/229#issue-2176062346? Thanks!
Please submit a PR with additional test cases. Thanks!
System information
Describe the problem
n.risk
attime == 0
is not correct whennlevels(strata) > 1
infortify.survfit(*, surv.connect = TRUE)
.Source code / logs / plots
The issue is from: https://github.com/sinhrks/ggfortify/blob/5ed95240075a7322bd910402d0a1d259f0e98f02/R/fortify_surv.R#L65
Maybe it can be changed to
d[d$time == ave(d$time, d$strata, FUN = min), ]
.And then this will need to be simplified:
https://github.com/sinhrks/ggfortify/blob/5ed95240075a7322bd910402d0a1d259f0e98f02/R/fortify_surv.R#L73-L79