Closed edbonneville closed 4 months ago
Also reported by Jonas Faartoft Jensen:
Regarding my previous question about the use of the msprep-function from the mstate-package in R for data preparation of cyclic multistate models, I had an idea (inspired by some ideas from my colleagues). The thought was that I could initially construct the model as a unidirectional, irreversible and acyclic multistate model by simply coding reversible states as new states in the model (so e.g. after a state of sickness you could return to being healthy again but coded separately as a state “healthy after first period of sickness” and so on). So – I tried to implement this idea on a hypothetical data only including a few patients; but when I try to use the msprep function it returns an error “Error in time[,-startings]: incorrect number of dimensions”. I tracked down the error through the code documentation of msprep and msprepEngine to almost the last line of msprepEngine where you use the Recall-function in order to create the recursive functionality. And here the error makes sense because the call of time and status tries to subset these variables as if they are matrices, when they in some previous step in fact have been transformed to vectors (because information on other individuals have been removed somewhere in the process). I have looked up this error also through an extensive google-search and found a few other cases with the same problem but without solutions. Do you know of this problem and how to maybe fix it?
Fixed, see: 981bdaf
Reported originally here by David Buis, where a fix was also proposed. Will be a simple fix by adding
, drop = FALSE
to this line.Created on 2024-06-14 with reprex v2.0.2