egor
objectR/composition.R
composition.Rd
composition()
calculates the proportional or absolute composition of
alters for a given attribute/variable.
composition(object, alt.attr, absolute = FALSE)
An egor
object.
A character
naming the variable containing the alter-attribute.
Logical
indicating if the results should be absolute.
A tibble
with the ego ID and values per category of alt.attr
as numeric
columns.
data("egor32")
composition(egor32, "sex")
#> # A tibble: 32 × 3
#> .egoID m w
#> <dbl> <dbl> <dbl>
#> 1 1 0.417 0.583
#> 2 2 0.333 0.667
#> 3 3 0.667 0.333
#> 4 4 0.333 0.667
#> 5 5 0.5 0.5
#> 6 6 0.583 0.417
#> 7 7 0.333 0.667
#> 8 8 0.583 0.417
#> 9 9 0.417 0.583
#> 10 10 0.333 0.667
#> # … with 22 more rows