I have a question about re-shaping (if that's the right word) a data frame to a transposed version of it. I want to take something like:
A B C
1 6 1
1 18 1
1 21 1
3 18 1
3 21 1
4 6 1
4 18 1
4 20 1
4 21 1
And turn it into a dataframe like:
A B_1 C_1 B_2 C_2 B_3 C_3 ...
1 6 1 18 1 21 1
3 18 1 21 1
4 6 1 18 1 20 1 21 1
Is there some go-to function in R that I'm unaware of or should I loop over this process? Thanks!