alts_diversity_count()
counts the categories of a variable present in the
networks of an egor
object. alts_diversity_entropy()
calculates the Shannon
entropy as a measurement for diversity of an alter attribute.
Arguments
- object
An
egor
object.- alt.attr
A
character
naming the variable containing the alter-attribute.- base
Numeric
, base value of logarithm for entropy calculation.
Examples
data("egor32")
alts_diversity_count(egor32, "age")
#> # A tibble: 32 × 2
#> .egoID diversity
#> <dbl> <dbl>
#> 1 1 5
#> 2 2 5
#> 3 3 6
#> 4 4 6
#> 5 5 5
#> 6 6 6
#> 7 7 5
#> 8 8 5
#> 9 9 5
#> 10 10 5
#> # ℹ 22 more rows
alts_diversity_entropy(egor32, "age")
#> # A tibble: 32 × 2
#> .egoID entropy
#> <dbl> <dbl>
#> 1 1 2.19
#> 2 2 2.19
#> 3 3 2.42
#> 4 4 2.36
#> 5 5 2.19
#> 6 6 2.46
#> 7 7 2.08
#> 8 8 2.13
#> 9 9 2.19
#> 10 10 2.19
#> # ℹ 22 more rows