Specifies which group an element in the input collection belongs to.
Specifies which group an element in the input collection belongs to.
Three-element array holding a unique value, the value count, and the frequency percentage.
Specifies which group an element in the input collection belongs to.
Generates a frequency table according to a provided function.
When invoked, the indicator function is provided two arguments:
value
: collection valueindex
: collection indexThe output is an array of arrays. Each sub-array corresponds to a unique value in the input collection and is structured as follows:
If provided an empty collection, the function returns an empty array.
input collection
function whose return values are used to populate the output frequency table
frequency table
function indicator( value ) {
return value[ 0 ];
}
var arr = [ 'beep', 'boop', 'foo', 'beep' ];
var out = tabulateBy( arr, indicator );
// returns [ [ 'b', 3, 0.75 ], [ 'f', 1, 0.25 ] ]
Generates a frequency table according to a provided function.
When invoked, the indicator function is provided two arguments:
value
: collection valueindex
: collection indexThe output is an array of arrays. Each sub-array corresponds to a unique value in the input collection and is structured as follows:
If provided an empty collection, the function returns an empty array.
input collection
function options
function whose return values are used to populate the output frequency table
frequency table
function indicator( value ) {
return value[ 0 ];
}
var arr = [ 'beep', 'boop', 'foo', 'beep' ];
var opts = {
'thisArg': {}
};
var out = tabulateBy( arr, opts, indicator );
// returns [ [ 'b', 3, 0.75 ], [ 'f', 1, 0.25 ] ]
Specifies which group an element in the input collection belongs to.
collection value
collection index
frequency table value