composition() calculates the proportional or absolute composition of alters for a given attribute/variable.

composition(object, alt.attr, absolute = FALSE)

Arguments

object

An egor object.

alt.attr

A character naming the variable containing the alter-attribute.

absolute

Logical indicating if the results should be absolute.

Value

A tibble with the ego ID and values per category of alt.attr as numeric columns.

Examples

data("egor32") composition(egor32, "sex")
#> # A tibble: 32 x 3 #> .egoID m w #> <fct> <dbl> <dbl> #> 1 1 0.75 0.25 #> 2 2 0.632 0.368 #> 3 3 0.562 0.438 #> 4 4 0.588 0.412 #> 5 5 0.7 0.3 #> 6 6 0.562 0.438 #> 7 7 0.636 0.364 #> 8 8 0.588 0.412 #> 9 9 0.778 0.222 #> 10 10 0.636 0.364 #> # … with 22 more rows