Internal helper used by compute_matrix() to translate user-facing
grouping specs into the participant- and contact-side column names that
the matrix machinery joins on.
Each entry of by may be:
the string "age" — special-cased to the package's existing
convention (age.group on participants, contact.age.group on
contacts), as produced by assign_age_groups().
any other single string "<stem>" — resolves to part_<stem> on
participants and cnt_<stem> on contacts (the package's existing
convention for raw survey columns, e.g. part_gender / cnt_gender).
a named two-element character vector c(part = "X", cnt = "Y") — an
explicit override.
resolve_groupings(by)a list of list(name, part, cnt) triples
character vector or list of entries as described above