I have an income dataset that looks like this.
| CITY | 2014 | 2015 |
|---|---|---|
| AA | 21 | 22 |
| BB | 21 | 24 |
I am trying to find a way to make the dataset look like this.
| CITY | Income | Year |
|---|---|---|
| AA | 21 | 2014 |
| AA | 21 | 2014 |
| BB | 22 | 2015 |
| BB | 24 | 2015 |
I tried to pivot this using the tidyr package but I've not been successful so far. Is there any other package or code that would allow for this transformation?
Thank you!