Skip to contents

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

Usage

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 × 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
#> # ℹ 22 more rows