If I have data that looks like this
| Condition 1 | Condition 2 |
|---|---|
| 11 | 41 |
| 17 | 45 |
where the numeric values are length.
Is there a way to change the data so that it looks like this instead
| Condition | length |
|---|---|
| Condition 1 | 11 |
| Condition 1 | 17 |
| Condition 2 | 41 |
| Condition 2 | 45 |
I've looked at transpose, unite, and pivot_longer. But it seemed like it wouldn't give me the results I was looking for. Does anybody have any suggestions?
The base function
stackis a straightforward way to accomplish this:I'm sure that there must be a
pivot_longerapproach that will work as well.