same_pairs {ERPM}R Documentation

Same pairs of individuals in a partition

Description

This function computes the total number, the average number having the same value of a categorical variable and the number of individuals a partition.

Usage

same_pairs(partition, attribute, stat)

Arguments

partition

A partition (vector)

attribute

A vector containing the values of the attribute

stat

The statistic to compute : 'avg_pergroup' for the average, 'sum_pergroup' for the sum, 'sum_perind' and 'avg_perind' for the number of ties per individual each individual has in its group.

Value

The statistic chosen in stat

Examples

p <- c(1,2,2,3,3,4,4,4,5)
at <- c(0,1,1,1,1,0,0,0,0)
same_pairs(p,at,'avg_pergroup')

[Package ERPM version 0.2.0 Index]