Social Contact Matrices for Sub-Saharan Africa
# **Social Contact Matrices for Sub‑Saharan Africa**
`ssamixr` provides harmonized, ready‑to‑use **social contact matrices**
from empirical studies conducted across Sub‑Saharan Africa. The package includes **171 matrices** covering multiple countries,
settings, and study designs, all standardized for infectious disease modeling and comparative epidemiology.
------------------------------------------------------------------------
# 🚀 Installation
``` r
# Install pak if needed
if (!requireNamespace("pak", quietly = TRUE)) {
install.packages("pak")
}
# Install ssamixr package
pak::pak("fbkengne/ssamixr")
# Load the package
library(ssamixr)
```
🧭 Getting Started: A Simple Workflow
Most users will want to:
1. List all available matrices
2. Filter matrices by country, study, or location
3. Select a matrix ID
4. Retrieve the matrix
5. Visualize it
1️⃣ List all matrices
``` r
all_mats # A tibble: 6 × 7
#> matrix_id study_id author_year country location_type row_age_groups
#>
#> 1 201 Cameroon_Dobreva_2… Dobreva et… Camero… HH 0-17;18-55;56+
#> 2 202 Cameroon_Dobreva_2… Dobreva et… Camero… School;Work 0-17;18-55;56+
#> 3 203 Cameroon_Dobreva_2… Dobreva et… Camero… Other 0-17;18-55;56+
#> 4 204 Cameroon_Dobreva_2… Dobreva et… Camero… All 0-17;18-55;56+
#> 5 205 Cameroon_Dobreva_2… Dobreva et… Camero… All 0-17;18-55;56+
#> 6 206 DR_Congo_Dobreva_2… Dobreva et… Democr… HH 0-17;18-55;56+
#> # ℹ 1 more variable: col_age_groups
```
2️⃣ Filter matrices
Example: matrices from Kenya
``` r
kenya
Gradient palette
``` r
plot_matrix_gradient(m)
```
🔧 Visualization Parameters
Both plot_matrix() and plot_matrix_gradient() support flexible,
publication‑ready visualization of social contact matrices.
Automatic label rotation
By default:
If the matrix has more than 10 age groups, column labels rotate
vertically
Otherwise, they remain horizontal
You can override th …