number_categories {ERPM}R Documentation

Number of individuals having an attribute

Description

This function computes the total number of individuals being in a category of an attribute in a partition. It also computes the sum of the proportion in each group of individuals being in a category.

Usage

number_categories(partition, attribute, stat, category)

Arguments

partition

A partition (vector)

attribute

A vector containing the values of the attribute

stat

The statistic to compute : 'avg' for the sum of proportion per group and 'sum' for the total number

category

The category to consider or category = 'all' if all categories have to be considered

Value

The statisic chosen in stat depending on the value of category. If category = 'all', returns a vector.

Examples

p <- c(1,2,2,3,3,4,4,4,5)
at <- c(1,0,0,0,1,1,0,0,1)
number_categories(p,at,'avg','all')

[Package ERPM version 0.2.0 Index]