Here is data frame I have:
.id dn mavg up pctB
1 18.8 21.1 23.4 0.8
1 18.7 21.1 23.5 0.8
1 18.7 21.2 23.7 0.8
2 23.1 24.6 26.1 0.5
2 23.1 24.6 26.0 0.4
2 23.1 24.5 26.0 0.5
3 145.5 179.2 212.9 0.3
3 144.2 177.4 210.7 0.3
3 143.4 175.6 207.7 0.3
The shape that I want to have is following:
.id dn.1 dn.2 dn.3 mavg.1 mavg.2 mavg.3 up.1 up.2 up.3 pctB.1 pctB.2 pctB.3
1 18.8 18.7 18.7 21.1 21.1 21.2 23.4 23.5 23.7 0.8 0.8 0.8
2 23.1 23.1 23.1 24.6 24.6 24.5 26.1 26 26 0.5 0.4 0.5
3 145.5 144.2 143.4 179.2 177.4 175.6 212.9 210.7 207.7 0.3 0.3 0.3
I know how to keep only one of columns from my original data frame, but I need to keep every column like right above. How can I do this?