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

    Function tabulate

    • Counts of the integers 1..nbins in bin (values truncated towards 0; others, NaN, infinite values and values beyond the integer range of R are not counted). Equivalent to R's tabulate(). nbins defaults to max(1, bin) and is truncated towards 0, as R does; it is the second argument or the option nbins (giving both is a RangeError).

      Parameters

      • bin: Sample
      • Optionalnbins: number

      Returns number[]

      tabulate([1, 2, 2, 5]);    // [1, 2, 0, 0, 1]
      tabulate([1, 2, 2, 5], 3); // [1, 2, 0]
    • Counts of the integers 1..nbins in bin, with the number of bins in the options: tabulate(bin, { nbins: 3 }).

      Parameters

      Returns number[]

      tabulate([1, 2, 2, 5], { nbins: 3 }); // [1, 2, 0]