Its my first time in the forum so apologies for the way i am articulating the question! I use tidyverse in R and I have a tbl_df like this:
Month | Price |
---|---|
1 | 10 |
1 | 111 |
1 | 19 |
2 | 2 |
2 | 49 |
3 | 80 |
3 | 560 |
I want to convert it so that there are three columns named 1, 2 , 3 for the months and each column lists the prices corresponding to that month. Something like:
1 | 2 | 3 |
---|---|---|
10 | 2 | 80 |
111 | 49 | 560 |
19 |
Any help on how this can be done is much appreciated!