mclements / rstpm2

An R package for generalised survival models
28 stars 11 forks source link

Error when there is no censoring #6

Closed LasseHjort closed 7 years ago

LasseHjort commented 7 years ago

Dear Mark

Thank you for providing an excellent package. When doing some simulations, I come across a problem. The function stpm2 fails if there are no censored samples.

This is due to the lines event <- eval(eventExpr, data) event <- event > min(event) If the status variable is equal to 1 for all samples, all values of 'events' will be FALSE. I think you have to check the class of the status variable (logical or numeric) and then create 'event' according to this.

Best, Lasse

mclements commented 7 years ago

Lasse, as discussed, we have now implemented a check for this corner case. Thank you for your feedback. -- Mark