Skip to content

socialmixr 0.5.0

Choose a tag to compare

@sbfnk sbfnk released this 19 Jan 21:03

This release focuses on improved modularity and flexibility for contact matrix
workflows. Key highlights include new standalone functions for age group
assignment and population data retrieval, more intuitive handling of age
limits, and the beginning of a transition to the
contactsurveys package for
survey downloads.

We thank Nicholas Tierney (@njtierney), Lander Willem (@lwillem), Hugo Gruson
(@Bisaloo), Lloyd Chapman (@LloydChapman), James Azam (@jamesmbaazam), and
Abdoelnaser Degoot (@Degoot-AM) for their contributions to this release.

Breaking changes

  • contact_matrix() now preserves all user-specified age_limits, even when
    no participants exist in some age groups. Previously, age groups beyond the
    maximum participant age were silently dropped. Empty age groups now show
    0 participants and NA values in the matrix. This may change matrix dimensions
    for existing code (@Bisaloo, #144, #231).

  • contact_matrix(counts = TRUE)$matrix now returns an array rather than an
    xtabs object. This matches the existing output format of
    contact_matrix(counts = FALSE)$matrix (@Bisaloo, #118).

  • When age_limits is not specified, it is now inferred from both participant
    and contact ages, not just participant ages. This may result in more age
    groups if contacts include ages beyond the participant age range (#230).

New features

  • as_contact_survey() no longer requires country and year columns. These
    columns are now auto-detected if present, but surveys without them can be
    loaded successfully (#193, #199).

  • New assign_age_groups() and survey_country_population() functions allow
    modular pre-processing of survey data (#131, #226).

  • Reduced verbosity by removing messages about removing participants/contacts
    with missing ages (#228).

Bug fixes

  • clean() now correctly processes age values with units (e.g., "6 months",
    "52 weeks") (@LloydChapman, #250, #256).

  • contact_matrix() now warns when a survey contains multiple observations per
    participant, as results will aggregate across all observations (#260).

  • load_survey() now correctly loads longitudinal surveys with repeated
    observations per participant (e.g., sday files with wave/studyDay columns).
    Previously, these columns were silently dropped (@njtierney, #192, #194).

  • Fixed a bug leading to excess contacts with NA age if the lowest age group
    did not start at 0 (@lwillem, #170).

Deprecations

  • Argument names with dots (e.g., age.limits) have been deprecated in favour
    of underscores (e.g., age_limits) in contact_matrix(),
    as_contact_survey(), pop_age(), and clean(). The old argument names
    still work but will produce deprecation warnings (#160).

  • get_survey(), download_survey(), get_citation(), list_surveys(), and
    survey_countries() have been soft-deprecated and moved to
    contactsurveys. This is
    part of decoupling these features from socialmixr to reduce dependencies
    (@njtierney, #179, #207). These will continue to work until version 1.0.0.

  • The missing_contact_age = "sample" option in contact_matrix() and
    assign_age_groups() has been soft-deprecated. Use "remove" to exclude
    contacts with missing ages, "keep" to retain them as a separate age group,
    or "ignore" to drop only those contacts (#273).