Add column, "intergenerational"
add_intergenerational.Rd
For modelling purposes it is useful to have a feature that is the absolute
difference between age_from
and age_to
columns.
Examples
polymod_contact <- get_polymod_contact_data()
polymod_contact %>% add_intergenerational()
#> # A tibble: 8,787 × 6
#> setting age_from age_to contacts participants intergenerational
#> <chr> <int> <dbl> <int> <int> <dbl>
#> 1 all 0 0 31 92 0
#> 2 all 0 1 15 92 1
#> 3 all 0 2 23 92 2
#> 4 all 0 3 22 92 3
#> 5 all 0 4 16 92 4
#> 6 all 0 5 12 92 5
#> 7 all 0 6 10 92 6
#> 8 all 0 7 12 92 7
#> 9 all 0 8 7 92 8
#> 10 all 0 9 8 92 9
#> # ℹ 8,777 more rows