Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Combine items into sublists based on their position
ResourceFunction["GatherByIndex"][list,f] gathers into sublists each set of elements in list that gives the same value when f is applied to its index. |
See which words Shakespeare's Mark Antony used at prime locations:
In[2]:= | ![]() |
Out[2]= | ![]() |
This is data showing activity of requests on a server for each hour over several months:
In[3]:= | ![]() |
In[4]:= | ![]() |
Out[4]= | ![]() |
Stack each hour to show daily trends:
In[5]:= | ![]() |
Out[5]= | ![]() |
MapIndexed uses the full part specification given as a List:
In[6]:= | ![]() |
Out[6]= | ![]() |
GatherByIndex is applied to the index at the first level, so the position is not given as a List:
In[7]:= | ![]() |
Out[7]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License