Learn R Programming

socialmixr (version 0.7.0)

weighted_matrix_array: Cross-tab contact weights over grouping columns

Description

Internal helper used by compute_matrix() and contact_matrix() to turn a merged contacts table into the rank-2K array of weighted contact counts. Each grouping contributes a participant-side and a contact-side axis, in that order across the two halves of the array.

Usage

weighted_matrix_array(contacts, groupings = default_age_groupings())

Value

a rank-2K array with K = length(groupings)

Arguments

contacts

the merged contacts data.table (must have sampled.weight plus the participant/contact columns referenced by groupings)

groupings

a list of grouping triples (see resolve_groupings()); defaults to single-age, matching pre-existing single-grouping output