Provided an egor-object, these functions create a 'global' data.frame, containing alter attributes, or alter-alter relations. The resulting dataframes are useful for advanced analysis procedures, e.g. multi-level regressions.

as_alters_df(object, include.ego.vars = FALSE)

as_aaties_df(object, include.ego.vars = FALSE, include.alter.vars = FALSE)

Arguments

object

An egor object. a new variable with the specified name is created.

include.ego.vars

Logical, specifying if ego variables should be included in the result.

include.alter.vars

Logical, specifying if alter variables should be included in the result.

Value

A tibble.

Details

These functions are convenience functions for egor's as_tibble method.

Examples

# Load example data data(egor32) # Create global alters dataframes as_alters_df(egor32)
#> # A tibble: 478 x 7 #> .altID .egoID sex age age.years country income #> <int> <fct> <fct> <fct> <int> <fct> <dbl> #> 1 1 1 w 66 - 100 75 Australia 42340 #> 2 2 1 m 18 - 25 17 Germany 730 #> 3 3 1 w 66 - 100 91 Australia 23360 #> 4 4 1 m 0 - 17 10 USA 27010 #> 5 5 1 m 66 - 100 67 Poland 33215 #> 6 6 1 m 0 - 17 10 USA 31755 #> 7 7 1 m 0 - 17 12 Australia 11680 #> 8 8 1 m 66 - 100 97 USA 67890 #> 9 1 2 w 66 - 100 75 Australia 42340 #> 10 2 2 m 18 - 25 17 Germany 730 #> # … with 468 more rows
# Create global alter-alter relaions dataframes as_aaties_df(egor32)
#> # A tibble: 1,858 x 4 #> .egoID .srcID .tgtID weight #> <fct> <int> <int> <dbl> #> 1 32 13 18 0.333 #> 2 18 11 22 0.667 #> 3 28 5 19 0.667 #> 4 19 5 6 1 #> 5 32 2 19 0.667 #> 6 22 3 15 0.667 #> 7 14 3 7 0.333 #> 8 15 5 8 0.333 #> 9 11 10 12 0.333 #> 10 13 12 17 1 #> # … with 1,848 more rows
# ... adding alter variables as_aaties_df(egor32, include.alter.vars = TRUE)
#> # A tibble: 1,858 x 14 #> .egoID .srcID .tgtID weight sex_src age_src age.years_src country_src #> <fct> <int> <int> <dbl> <fct> <fct> <int> <fct> #> 1 32 13 18 0.333 m 66 - 1… 67 Poland #> 2 18 11 22 0.667 w 66 - 1… 78 USA #> 3 28 5 19 0.667 m 66 - 1… 67 Poland #> 4 19 5 6 1 m 66 - 1… 67 Poland #> 5 32 2 19 0.667 m 18 - 25 17 Germany #> 6 22 3 15 0.667 w 66 - 1… 91 Australia #> 7 14 3 7 0.333 w 66 - 1… 91 Australia #> 8 15 5 8 0.333 m 66 - 1… 67 Poland #> 9 11 10 12 0.333 w 66 - 1… 87 Germany #> 10 13 12 17 1 w 26 - 35 31 USA #> # … with 1,848 more rows, and 6 more variables: income_src <dbl>, #> # sex_tgt <fct>, age_tgt <fct>, age.years_tgt <int>, country_tgt <fct>, #> # income_tgt <dbl>