Learn R Programming

socialmixr (version 0.7.0)

n_participants_per_group: Count participants per grouping combination

Description

Cross-tabulates participants across all participant-side grouping columns and returns a long data.table with one row per observed combination, plus the share of participants in each cell. Used by compute_matrix() to populate the participants slot of a contact_matrix object.

Usage

n_participants_per_group(participants, groupings = default_age_groupings())

Value

a long data.table with one column per grouping plus participants and proportion

Arguments

participants

the participants data.table

groupings

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