Given a vector where each element is a group index for the corresponding entry, returns a list of vectors containing the indices of entries in each group.
Value
A list of integer vectors, where each vector contains the indices of entries belonging to that group
Details
This is the inverse operation of assigning group indices. It's useful for converting a per-entry group assignment into a per-group member list.
Examples
if (FALSE) { # \dontrun{
# If entries 1,3 are in group 1, entry 2 is in group 2, entry 4 is in no group
group_indices <- c(1L, 2L, 1L, 0L)
members <- collect_group_members(group_indices)
# Returns: list(c(1L, 3L), c(2L))
} # }