I am currently trying to model a multi-state survival problem. Subjects can be in one of 1 states (A through C). All states are sequentially entered and there is no reversal or jumping (i.e You must go from A-> B -> C in order, you can't go from A->C and you can' go backwards from C->B or B->A).
I have timestamps for entrance into each state as follows:
data.frame(
subject = 1:10,
start_time = c("2023-01-02 00:00:18",
"2023-01-02 00:02:58","2023-01-02 00:03:08",
"2023-01-02 00:04:18","2023-01-02 00:03:41",
"2023-01-02 00:05:18","2023-01-02 00:04:45","2023-01-02 00:07:34",
"2023-01-02 00:07:57","2023-01-02 00:08:41"),
enters_A = c("2023-01-02 00:02:00",
"2023-01-02 00:03:24","2023-01-02 00:04:05",
"2023-01-02 00:04:35","2023-01-02 00:05:06",
"2023-01-02 00:05:31","2023-01-02 00:06:09","2023-01-02 00:07:44",
"2023-01-02 00:08:09","2023-01-02 00:08:47"),
enters_B = c(NA,NA,NA,
"2023-01-02 00:05:45","2023-01-03 21:30:41","2023-01-02 01:07:47",
NA,"2023-01-02 00:09:08",NA,"2023-01-02 00:09:23"),
enters_C = c(NA,NA,NA,NA,
"2023-01-03 22:12:29","2023-01-02 17:05:58",NA,
"2023-01-02 00:19:05",NA,NA))
How can I reshape this data to use with tmerge
and then eventually in multistate survival models?