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.0126 0.00418 #> 2 2 0.0251 0.0146 #> 3 3 0.0188 0.0146 #> 4 4 0.0209 0.0146 #> 5 5 0.0146 0.00628 #> 6 6 0.0188 0.0146 #> 7 7 0.0146 0.00837 #> 8 8 0.0209 0.0146 #> 9 9 0.0146 0.00418 #> 10 10 0.0146 0.00837 #> # … with 22 more rows