rStats.js v1.3.0
    Preparing search index...

    Function tapply

    • The function applied to the values of each group. Equivalent to R's tapply(x, index, fun).

      index is one array of group labels (one per value of x) or an array of such arrays, one per factor. The function is called only for the non-empty cells; a value of x whose label is missing is left out.

      Type Parameters

      • T
      • R

      Parameters

      Returns TapplyResult<R>

      tapply([1, 2, 3, 4], ["b", "a", "b", "a"], (v) => v.length); // { dim: [2], dimnames: [["a", "b"]], values: [2, 2] }