Skip to main content
1 of 3
Mr.Wizard
  • 273.1k
  • 34
  • 595
  • 1.4k

rcollyer pointed out in a comment that the the new GroupBy may be substituted for GatherBy in Szabolcs's original to produce the desired function:

cleanPosIdx[x_] := GroupBy[Range @ Length @ x, x[[#]] &]

I shall be using this code until PositionIndex receives and enhancement.

Mr.Wizard
  • 273.1k
  • 34
  • 595
  • 1.4k