Below are the contents of my dataset with 4 observations and 4 columns(a,b,c,d) with values x, y, z, x in each observation.
a b c d
1 x x x x
2 y y y y
3 z z z z
4 x x x x
Now, I need to transform this into below structure:
a1 b1 c1 d1 a2 b2 c2 d2 a3 b3 c3 d3 a4 b4 c4 d4
== == == == == == == == == == == == == == == ==
x x x x y y y y z z z z x x x x
In the other sense, all the row data needs to be transformed into columns (appending each column name with the observation a1, b1, a2, b2 etc...)
How I can achieve this, any easy way to accomplish this?