The situation is that I have a List like this:
A = { {1, 11}, {1, 12}, {1, 17}, {1, 20}, {1, 52}, {4, 179}, {5, 10},
{5, 55}, {12, 16}, {13, 274}, {15, 206}, {17, 16}, {17, 23}, {17, 24},
{17, 25}, {22, 82}, {26, 131}, {30, 222}, {30, 391}, {40, 24},
{41, 31}, {41, 54}, {41, 78}, {41, 82}, {43, 42}, {44, 67},
{45, 21}, {47, 81}, {49, 192}, {52, 10}, {56, 67}, {56, 76},
{56, 79}, {56, 81}, {56, 89}, {56, 90}, {56, 91}, {56, 92} }
I would like to order the list A by frequencies from first component.
I tried to figure out this order with this function:
frec = Table[i[[1, 1]] , {i,
Sort[Tally[A, #1[[1]] == #2[[1]] & ], #1[[2]] > #2[[2]] & ]}]
{56, 1, 41, 17, 30, 5, 52, 49, 47, 45, 44, 43, 40, 26, 22, 15, 13, 12, 4}
It means that 56 appears as first component more than 1, and so on.
But I really don't know how to use this order to produce something like this:
A = { {56, 67}, {56, 76}, {56, 79}, {56, 81}, {56, 89}, {56, 90}, {56, 91}, {56, 92},
{ 1, 11}, { 1, 12}, { 1, 17}, { 1, 20}, { 1, 52},
{41, 31}, {41, 54}, {41, 78}, {41, 82},
{17, 16}, {17, 23}, {17, 24}, {17, 25}, ... }