← Back to all sparks
S

socialmixr

ANALYTICS
Velocity0.0

Derive social mixing matrices from survey data.

socialmixr breaks its one-shot contact_matrix() call into a composable pipeline.

contact matricesepidemiologypipeline apibreaking changesr package
Current state
socialmixr builds age-structured social contact matrices from survey data for infectious-disease modelling. Version 0.6.0 replaces the monolithic contact_matrix() entry point with a chain of composable steps — filter, assign age groups, weigh, compute, then symmetrise, split or convert per capita — behind a new contact_matrix S3 class. Survey downloading is being handed off to a separate contactsurveys package.
Where it's heading
The arc from 0.4.0 to 0.6.0 is decomposition: first extracting helpers like assign_age_groups(), then moving downloads out of the package, and now exposing every stage of matrix construction as its own verb. Breaking changes are accepted at each step — preserved empty age groups, arrays instead of xtabs, [N,Inf) labels — with the new class inheriting from list so existing $matrix access keeps working. The label change is explicitly aligned with the contactmatrix package.
Prediction
Expect the deprecated dotted argument names and the remaining in-package download paths to be removed once the contactsurveys handoff completes, leaving contact_matrix() as a thin wrapper over the pipeline.

Recent moves

  1. 3mo ago

    Contact matrices become a composable pipeline

    ⚡ SPARK

    The decomposition that started in 0.5.0 lands in full: seven composable verbs and a contact_matrix S3 class replace the single-call workflow, with the vignette and README rewritten around it. Terminal age-group labels switch to interval notation, matching the contactmatrix package.

    View source ↗
  2. 6mo ago

    Patch: load_survey() handles files without cont_id

    A patch fixing load_survey() on contact files that lack a cont_id column, plus vignette pointers to the new contactsurveys package — a small marker of the download handoff underway.

    View source ↗
  3. 6mo ago

    Age-group assignment and population lookup split out

    The groundwork for the 0.6.0 pipeline: assign_age_groups() and survey_country_population() become standalone steps, and user-specified age limits are honoured even where no participants fall in them. Several breaking output changes land here rather than being deferred.

    View source ↗
  4. 1y ago

    Faster survey loading and cached Zenodo lookups

    Performance work — faster loading, cached Zenodo responses — plus a fix for NA matrices caused by gaps in population data. Bracket age-range notation becomes the default here, foreshadowing the 0.6.0 label change.

    View source ↗
  5. 2y ago

    contact_matrix() now takes survey objects only

    contact_matrix() stops accepting DOIs, forcing the documented get_survey() then contact_matrix() route — an early instance of the same split-the-steps instinct that drives the later pipeline.

    View source ↗
  6. 2y ago

    Test fixes for machine-precision failures

    A test-only release addressing floating-point precision differences across platforms. No user-visible change.

    View source ↗