biostatsPMH / reportRx

Tools for automatically generating reproducible clinical report
Creative Commons Zero v1.0 Universal
2 stars 1 forks source link

etsum no longer accepts factors as response variables #16

Open ghost opened 3 years ago

ghost commented 3 years ago

This works:

etsum(data = lung, response = c("time","status"), group = 1, times=c(365,720,1095))

But this doesn’t:

lung$Status = factor(lung$status-1) etsum(data = lung, response = c("time","Status"), group = 1, times=c(365,720,1095))

egosv commented 3 years ago

I'm looking into this, and appears that survfit is the culprit. Notice that the two outputs below are different:

summary(survfit(Surv(time, status) ~ 1, data=lung), times=c(365,720,1095))$table

summary(survfit(Surv(time, Status) ~ 1, data=lung), times=c(365,720,1095))$table

etsum relies on summary.survfit to obtain some values. So, until I dig further into this, I'm throwing an error in etsum if the second entry is a factor. Not closing this issue just yet.