faultlines_dsg: Computes the distances within and between sub-groups based on...

Description Usage Arguments Value See Also Examples

Description

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)

Usage

1
faultlines_dsg(x, subgroup)

Arguments

x

dataframe. Binary variables indicating the categorical memberships of group members.

subgroup

character. Name of the variable indicating subgroup membership.

Value

A dataframe with one row per attribute specifying the contribution of each attribute to subgroups internal alignements, cross group alignement, and faultline.

See Also

make_discrete

find_subgroups

Examples

 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()

NicolasJBM/construct documentation built on May 28, 2019, 2:20 p.m.