Invert group-index assignment into per-group entry lists.
Source:R/groups.R
collect_group_members.RdFor each non-zero group in group_indices, returns the integer
positions that belong to it. Entries with index 0 are omitted.
Examples
collect_group_members(c(1L, 2L, 1L, 0L, 2L))
#> [[1]]
#> [1] 1 3
#>
#> [[2]]
#> [1] 2 5
#>
# list(c(1, 3), c(2, 5))