I have origin-destination data which is not ordered and want to deduct a path from it. Therefore I want to add an order column which contains the number of the "steps".
Following data table should contain the path of A-B-A-C-D-E:
DT_Test<-data.table(Origin=c("B","A","C","D","A"),Destination=c("A","C","D","E","B"),User=c("U56","U56","U56","U56","U56"))
Goal:
Is there any existing function/package to do this (with a by-statement on "User")?