Skip to contents

Print a contactmatrix_list

Usage

# S3 method for class 'contactmatrix'
print(x, ...)

Arguments

x

A contactmatrix_list object

...

Ignored for now

Value

x, invisibly

Examples

cm2d <- new_contactmatrix(
  from  = c("[0,5)", "[5,10)",  "[5,10)"),
  to    = c("[0,5)", "[10,15)", "[15,20)"),
  value = c(0.32   , 0.46   , 0.72   ),
  symmetric = TRUE
)
print(cm2d)
#> 
#> ── Symmetric Contact matrix ──
#> 
#> ── Groupings 
#> [1] "[0,5)"   "[10,15)" "[15,20)" "[5,10)" 
#> 
#> ── Contact rates 
#>          _to
#> _from     [0,5) [10,15) [15,20) [5,10)
#>   [0,5)    0.32    0.00    0.00      0
#>   [10,15)  0.00    0.00    0.00      0
#>   [15,20)  0.00    0.00    0.00      0
#>   [5,10)   0.00    0.46    0.72      0

# Multi-groupings
cm3d <- new_contactmatrix(
  from  = list(
    age = c("young", "young", "old"),
    gender = c("male", "female", "female")
  ),
  to    = list(
    age    = c("old", "old", "young"),
    gender = c("female", "female", "female")
  ),
  value = c(1, 2, 2)
)
print(cm3d)
#> 
#> ── Contact matrix ──
#> 
#> ── Groupings 
#> $age
#> [1] "old"   "young"
#> 
#> $gender
#> [1] "female" "male"  
#> 
#> 
#> ── Contact rates 
#> , , age_to = old, gender_to = female
#> 
#>         gender_from
#> age_from female male
#>    old        0    0
#>    young      2    1
#> 
#> , , age_to = young, gender_to = female
#> 
#>         gender_from
#> age_from female male
#>    old        2    0
#>    young      0    0
#> 
#> , , age_to = old, gender_to = male
#> 
#>         gender_from
#> age_from female male
#>    old        0    0
#>    young      0    0
#> 
#> , , age_to = young, gender_to = male
#> 
#>         gender_from
#> age_from female male
#>    old        0    0
#>    young      0    0
#>