epiverse-trace / epiverse-trace/finalsize
`socialmixr` 0.6.0: pass `survey_pop` explicitly to `contact_matrix()`
- Dominant language
- R
- Stars
- 15
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
The just-released socialmixr 0.6.0 adds a deprecation warning to the implicit country → population lookup that `contact_matrix(countries = ...)` performs when `symmetric`, `split`, `per_capita`, `weigh_age`, or `return_demography` is set without an explicit `survey_pop`. The implicit lookup will be removed in socialmixr 0.8.0.
finalsize triggers this in several places — among them the vignettes uncertainty_params.Rmd, varying_contacts.Rmd, varying_susceptibility.Rmd, and the test file test-basic.R, all of which call `socialmixr::contact_matrix(..., countries = "United Kingdom", symmetric = TRUE)` (or similar) without `survey_pop`. From socialmixr 0.6.0 onwards these will emit a deprecation warning; in 0.8.0 they will error.
The fix is to pass survey_pop as a data.frame with columns lower.age.limit and population, e.g. using the wpp2024 package (`remotes::install_github("PPgp/wpp2024")`):
```r
data("popAge1dt", package = "wpp2024")
uk_pop <- popAge1dt[name == "United Kingdom" & year == 2020,
.(lower.age.limit = age, population = pop * 1000)
]
socialmixr::contact_matrix(survey, countries = "United Kingdom", symmetric = TRUE, survey_pop = uk_pop)
```
A hand-constructed data.frame works equally well.
Contributor guide
Assessment
This issue has not been assessed yet.