Error in processdata(formula, data) :
program logic error: variables vary in length but subset= was not given
The problem is fixed by changing the dtype of the event variable to a logical before the three lines above: dat$surv_event <- as.logical(dat$surv_event).
It seems that the Surv function allows for use of either logical or (0, 1) for event. Maybe it would help to cast the event to a logical in rms? I'm a beginner in R, so maybe I need to improve my skills.
I have a tibble "dat" with possible predictors, a survival time, an event indicator (0, 1). However, running the below gives an error:
dd <- datadist(dat) options(datadist="dd") rms <- cph(Surv(survival_time, survival_event) ~ predictor_var, data=dat)
The problem is fixed by changing the dtype of the event variable to a logical before the three lines above: dat$surv_event <- as.logical(dat$surv_event).
It seems that the Surv function allows for use of either logical or (0, 1) for event. Maybe it would help to cast the event to a logical in rms? I'm a beginner in R, so maybe I need to improve my skills.