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

    Function cut

    • Interval numbers (1-based) of the values, or NaN outside the breaks. Equivalent to R's cut(..., labels = FALSE).

      Parameters

      • x: Sample
      • breaks: number | readonly number[]

        The break points (NaN among them is dropped, as R does; fewer than 2 left are an error), or a number of intervals (at least 2): then equal intervals over the range of x, widened by 1/1000 of the range at each end, as R does. That range must be finite.

      • options: CutOptions = {}

      Returns number[]

      cut([1, 2.5, 4, 6], [0, 2, 4, 6]);                  // [1, 2, 2, 3]
      cut([1, 2.5, 4, 6], [0, 2, 4, 6], { right: false }); // [1, 2, 3, NaN]