I have a table, say, with about 1000 rows and 6 columns. Out of six elements in a row, first two are independent parameters, while rest four are dependent parameters. Say, the header of the table is {x, y, f1[x, y], f2[x, y], f3[x, y], f4[x, y]}
.
Now, I want to rearrange this table so that it is sorted with respect to the numerical values of y
(and stacked horizontally, instead of vertically) so that the second column is removed. Now in this case, the header should become {x, y1-f1[x, y], y1-f2[x, y], y1-f3[x, y], y1-f4[x, y], y2-f1[x, y], y2-f2[x, y], y2-f3[x, y], y2-f4[x, y],.... }
. Obviously, now the number of columns will become 1 + 4n
. where n
is the number of unique elements in the second column.
Will appreciate any help.
PS: Sorting is not a problem, but no idea how to stack them horizontally. Also values of y
are not same for all x
. So the stacking should be such that if a (x, y)
combination is missing, there should be a blank space for it in the new matrix.
Thanks