range_attribute function

Range of attribute in groups

Range of attribute in groups

This function computes the sum or the average range of an attribute for groups in a partition.

range_attribute(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 per group and 'sum_pergroup' for the sum of the ranges

Returns

The statisic chosen in stat

Examples

p <- c(1,2,2,3,3,4,4,4,5) at <- c(3,5,23,2,1,0,3,9,2) range_attribute(p,at,'avg_pergroup')
  • Maintainer: Marion Hoffman
  • License: GPL (>= 3)
  • Last published: 2024-05-10