My Dataframe has the following structure:
| Start Value | Middle Value(s) | Final Value | Relationship |
|---|---|---|---|
| A | B | C | lowers, lowers |
| A | D, E | C | lowers, raises, raises |
I am trying to format the data so that I end up with:
| Start Value | Relationship | Final Value |
|---|---|---|
| A | lowers | B |
| B | lowers | C |
| A | lowers | D |
| D | raises | E |
| E | raises | C |
I have been struggling to format my data like this. At first I tried tidyr separate_rows() and some form of melting the data with reshape2 and data.table, but to no avail. Any suggestions?