Skip to contents

This function activates one of the data levels of an egor dataset, so that the dplyr verbs know which level to execute on.

Usage

# S3 method for class 'egor'
activate(.data, what)

Arguments

.data

The egor dataset.

what

Character naming the level to activate, this can be "ego", "alter" or "aatie".

Examples

e <- make_egor(5,50)
e %>% 
   activate("aatie") %>% 
   mutate(weight2 = 2 + weight) %>% 
   activate("alter") %>% 
   mutate(age.years = age.years^3)
#> # EGO data: 5 × 6
#>   .egoID sex   age      age.years country   income
#> *  <dbl> <chr> <fct>        <int> <chr>      <dbl>
#> 1      1 w     66 - 100        68 USA        62415
#> 2      2 m     66 - 100        73 Poland     22630
#> 3      3 w     66 - 100        69 Australia  15695
#> # ℹ 2 more rows
#> # ALTER data (active): 139 × 7
#>   .altID .egoID sex   age      age.years country   income
#> *  <int>  <dbl> <chr> <fct>        <dbl> <chr>      <dbl>
#> 1      1      1 m     66 - 100    636056 Australia  58400
#> 2      2      1 m     36 - 45      79507 Poland     42705
#> 3      3      1 m     0 - 17         343 Australia  59130
#> 4      4      1 w     26 - 35      32768 USA         6205
#> 5      5      1 w     46 - 55     148877 Australia  65700
#> # ℹ 134 more rows
#> # AATIE data: 941 × 5
#>   .egoID .srcID .tgtID weight weight2
#> *  <int>  <int>  <int>  <dbl>   <dbl>
#> 1      2     15     18  1        3   
#> 2      1      4     10  0.333    2.33
#> 3      1      3     14  0.333    2.33
#> # ℹ 938 more rows