Skip to main content
added 390 characters in body
Source Link
SHuisman
  • 3.6k
  • 11
  • 15

There is TallyBy in the WFR. The third argument you can put Identity to get all of them. See also:

ResourceFunction["TallyBy"][{{1, 1}, {1, 2}, {1, 2, 3}, {2, 3}}, First, Identity] // MapApply[Prepend]
{{3,{1,1},{1,2},{1,2,3}},{1,{2,3}}}

Note sure if the examples.count and the items should be on the same level, I have a feeling you might have meant:

ResourceFunction["TallyBy"][{{1, 1}, {1, 2}, {1, 2, 3}, {2, 3}}, First, Identity] // Map[Reverse]
{{3,{{1,1},{1,2},{1,2,3}}},{1,{{2,3}}}}

There is TallyBy in the WFR. The third argument you can put Identity to get all of them. See also the examples.

There is TallyBy in the WFR. The third argument you can put Identity to get all of them:

ResourceFunction["TallyBy"][{{1, 1}, {1, 2}, {1, 2, 3}, {2, 3}}, First, Identity] // MapApply[Prepend]
{{3,{1,1},{1,2},{1,2,3}},{1,{2,3}}}

Note sure if the count and the items should be on the same level, I have a feeling you might have meant:

ResourceFunction["TallyBy"][{{1, 1}, {1, 2}, {1, 2, 3}, {2, 3}}, First, Identity] // Map[Reverse]
{{3,{{1,1},{1,2},{1,2,3}}},{1,{{2,3}}}}
Source Link
SHuisman
  • 3.6k
  • 11
  • 15

There is TallyBy in the WFR. The third argument you can put Identity to get all of them. See also the examples.