View source: R/functions_statistics.R
same_pairs | R Documentation |
This function computes the total number, the average number having the same value of a categorical variable and the number of individuals a partition.
same_pairs(partition, attribute, stat)
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. |
The statistic chosen in stat
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')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.