Description Usage Arguments Value See Also Examples
Computes the distances within and between sub-groups based on the number of common attributes (how many times members of a subgroup fall in the same category) for faultline analyses (personal procedure)
1 | faultlines_dsg(x, subgroup)
|
x |
dataframe. Binary variables indicating the categorical memberships of group members. |
subgroup |
character. Name of the variable indicating subgroup membership. |
A dataframe with one row per attribute specifying the contribution of each attribute to subgroups internal alignements, cross group alignement, and faultline.
make_discrete
find_subgroups
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | library(construct)
data("fictiveteams")
# prepare the data: group the observations per team, dichotomize variables and identify subgroups
library(dplyr)
library(tidyr)
library(purrr)
fl <- fictiveteams %>%
group_by(team) %>%
nest() %>%
mutate(data = map(data, make_discrete, ncat = 2, method = "km")) %>%
mutate(subgp = map(data, find_subgroups, gpnbr = 2)) %>%
unnest()
# Compute demographic differences
fl %>%
group_by(team) %>%
nest() %>%
mutate(data = map(data, faultlines_dsg, subgroup = "subgroup")) %>%
unnest()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.