Description Usage Arguments Details Value Examples
This function outputs a dataframe containg serveral compositional measures for ego-centered-network data. It reports the proportion of each group in the network, the absolute count of groups present and, if provided the corresponding ego attribute, the EI-Index is employed as a measurment for ego's tendency to homo-/heterophily.
1 2 | composition(alteri, v_alt, netsize, egoID = "egoID", v_ego = NULL,
mode = "regular")
|
alteri |
|
v_alt |
A character naming the variable containg the alter-attribute. |
netsize |
|
egoID |
|
v_ego |
Character vector containing the ego attribute. Only needed for homophily index (EI). Caution: Levels of v_alt and v_ego need to correspond (see Details). |
mode |
A character. "regular" for a basic output, "all" for a complete output. |
v_ego is expected to consist of one entry per ego. The ego attributes are usually drawn from the ego dataframe. If the ego attribute is stored alongside the alteri data, make sure to drop repeated values per alteri (see example two).
Returns a dataframe with category counts, diversity and EI-Index values in an ego-centered network for a provided alter attribute.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # Load example data
data("egos32")
data("alteri32")
# Example one
composition(alteri32, v_alt = "alter.sex", netsize = egos32$netsize,
v_ego = egos32$sex)
# Example two
# - using an ego attribute stored in the alter dataframe.
ego.sex <- alteri32[!duplicated(alteri32$egoID), ]$ego.sex
res <- composition(alteri32, v_alt = "alter.sex", netsize = egos32$netsize,
v_ego = ego.sex)
# Using cbind() to show the ego attribute alongside the results might
# be helpful in many cases:
cbind(res, ego.sex)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.