repl.txt (869B)
1 2 {{alias}}( collection ) 3 Generates a frequency table. 4 5 The table is an array of arrays where each sub-array corresponds to a unique 6 value in the input collection. Each sub-array is structured as follows: 7 8 - 0: unique value 9 - 1: value count 10 - 2: frequency percentage 11 12 If provided an empty collection, the function returns an empty array. 13 14 Parameters 15 ---------- 16 collection: Array|TypedArray|Object 17 Input collection to tabulate. If provided an object, the object must be 18 array-like (excluding strings and functions). 19 20 Returns 21 ------- 22 out: Array<Array>|Array 23 Frequency table. 24 25 Examples 26 -------- 27 > var collection = [ 'beep', 'boop', 'foo', 'beep' ]; 28 > var out = {{alias}}( collection ) 29 [ [ 'beep', 2, 0.5 ], [ 'boop', 1, 0.25 ], [ 'foo', 1, 0.25 ] ] 30 31 See Also 32 -------- 33