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 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     46 - 55         47 Poland   47450
#> 2      2 w     26 - 35         31 USA      69350
#> 3      3 m     66 - 100        68 Germany  20075
#> # ℹ 2 more rows
#> # ALTER data (active): 112 × 7
#>   .altID .egoID sex   age      age.years country   income
#> *  <int>  <dbl> <chr> <fct>        <dbl> <chr>      <dbl>
#> 1      1      1 m     26 - 35      39304 USA        54750
#> 2      2      1 m     26 - 35      42875 Germany     3650
#> 3      3      1 w     66 - 100    704969 Poland     58400
#> 4      4      1 w     66 - 100    636056 Australia  42705
#> 5      5      1 m     36 - 45      79507 Poland     59130
#> # ℹ 107 more rows
#> # AATIE data: 631 × 5
#>   .egoID .srcID .tgtID weight weight2
#> *  <int>  <int>  <int>  <dbl>   <dbl>
#> 1      5      2     18  0.667    2.67
#> 2      1      1     24  0.667    2.67
#> 3      5     15     19  1        3   
#> # ℹ 628 more rows