I've been working with lists and am stuck on creating lists within a list based on the first element within that list. So for instance, if I have the list:
> list={{John,42},{Mary,52},{John,30},{Mary,25},{Joe,10}}
I would like to return this:
{{{Joe,10}},{{John,42},{John,30}},{{Mary,52},{Mary,25}}}
As you can see, this is basically a reorganized list within a list based on SortBy[...,First]
I can create the sorted version by simply doing:
SortBy[list,First]
Which would return:
{{Joe,10},{John,42},{John,30},{Mary,52},{Mary,25}}
But I would also like for each list to be grouped into another list based on the name
Any help would be much appreciated.