stc04003 / reReg

Regression methods for recurrent event data
https://www.sychiou.com/reReg/index.html
21 stars 5 forks source link

Error in rep(tmp, table(dat$id)) : invalid 'times' argument #27

Closed adrianvallsc closed 4 months ago

adrianvallsc commented 1 year ago

I am trying to plot a Recur() object. My dataset has the following shape:

Captura de pantalla 2023-07-05 a las 13 24 43

When I run reObj = with(data, Recur(time = t_stop, id = id, event= event)) I have no problem. However, when I try to plot the object with the function plot or plotEvents I obtain the error:

Error in rep(tmp, table(dat$id)) : invalid 'times' argument

stc04003 commented 1 year ago

Hello,

Thank you for using our package. The convention in our package is that when the terminal argument is not specified, event = 1 corresponds to the occurrence of the recurrent event of interest, while event = 0 corresponds to non-occurrence or right-censored events. However, there seems to be a contradiction in your data, as our package would read it as right-censored events at times 37, 94, 142, and 182, but also recurrent events at times 142 and 182.

To eliminate duplicated information from your data, perhaps, the following is what you are looking for? reObj <- with(data[7:9,], Recur(time = t_stop, id = id, event= event)); plot(reObj)

Best, Steven