I have this code:
test <- data.frame("ClaimType1" = "Derivative", "ClaimType2" = "Derivative","ClaimType3" = "Class", "ClaimType4" = "Class", "Time1" = c(2,5), "Time2" = c(8,4), "Time3" = c(1,3), "Time4" = c(10,9))
| claim1 | claim2 | claim3 | claim4 | time1 | time2 | time3 | time4 |
|---|---|---|---|---|---|---|---|
| Derivative | Derivative | Class | Class | 2 | 8 | 1 | 10 |
| Derivative | Derivative | Class | Class | 5 | 4 | 3 | 9 |
I'm looking sort the get it in the following output:
| claim1 | claim2 | claim3 | claim4 | time1 | time2 | time3 | time4 |
|---|---|---|---|---|---|---|---|
| Class | Derivative | Derivative | Class | 1 | 2 | 8 | 10 |
| Class | Derivative | Derivative | Class | 3 | 4 | 5 | 9 |
I'm trying to sort within a row, but I'm not sure how to link the claim and times together. I'm guessing a dictionary wouldn't work here since it's an array.