count_dyads() counts the attribute combinations of alter-alter ties/ dyads in ego-centered networks. The results can be returned as a wide or long tibble/ data.frame.

count_dyads(
  object,
  alter_var_name,
  return_as = c("wide", "long"),
  prefix = NULL
)

Arguments

object

An egor object.

alter_var_name

Character, naming the alter variable to use as attribute.

return_as

Character, either "wide" (default) or "long".

prefix

Character, added in front of variables. Only used if return_as is "wide". If NULL (default) prefix is automatically generated.

Value

Wide or long tibble/ data.frame.

Examples

data(egor32) count_dyads(object = egor32, alter_var_name = "country")
#> # A tibble: 32 x 11 #> .egoID dy_cou_Australi… dy_cou_Australi… dy_cou_Australi… dy_cou_Australi… #> <fct> <int> <int> <int> <int> #> 1 1 1 2 2 5 #> 2 2 3 12 7 9 #> 3 3 1 10 4 14 #> 4 4 6 9 3 8 #> 5 5 1 1 3 3 #> 6 6 5 5 5 6 #> 7 7 2 4 6 5 #> 8 8 2 10 8 11 #> 9 9 1 2 4 2 #> 10 10 1 4 4 3 #> # … with 22 more rows, and 6 more variables: dy_cou_Germany_USA <int>, #> # dy_cou_USA_USA <int>, dy_cou_Germany_Germany <int>, #> # dy_cou_Germany_Poland <int>, dy_cou_Poland_Poland <int>, #> # dy_cou_Poland_USA <int>
# Return result as long tibble. count_dyads(object = egor32, alter_var_name = "country", return_as = "long")
#> # A tibble: 292 x 3 #> .egoID dyads n #> <fct> <chr> <int> #> 1 1 Australia_Australia 1 #> 2 1 Australia_Germany 2 #> 3 1 Australia_Poland 2 #> 4 1 Australia_USA 5 #> 5 1 Germany_USA 2 #> 6 1 USA_USA 2 #> 7 2 Australia_Australia 3 #> 8 2 Australia_Germany 12 #> 9 2 Australia_Poland 7 #> 10 2 Australia_USA 9 #> # … with 282 more rows