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

# S3 method for 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 m     66 - 100        91 Australia  35770
#> 2      2 w     56 - 65         56 USA        14600
#> 3      3 m     66 - 100       100 Poland     13140
#> # … with 2 more rows
#> # ALTER data (active): 110 × 7
#>   .altID .egoID sex   age      age.years country   income
#> *  <int>  <dbl> <chr> <fct>        <dbl> <chr>      <dbl>
#> 1      1      1 w     0 - 17        1000 Germany     6205
#> 2      2      1 w     66 - 100    830584 Australia  47085
#> 3      3      1 w     0 - 17        3375 Germany    49275
#> 4      4      1 m     46 - 55     103823 Australia  47085
#> 5      5      1 w     66 - 100    941192 Germany    20440
#> # … with 105 more rows
#> # AATIE data: 589 × 5
#>   .egoID .srcID .tgtID weight weight2
#> *  <int>  <int>  <int>  <dbl>   <dbl>
#> 1      2     12     13  0.333    2.33
#> 2      4      5     21  1        3   
#> 3      2      5     14  0.667    2.67
#> # … with 586 more rows