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

    Function subtract

    • Element-wise difference with R's recycling (a shorter vector is recycled down the columns of a matrix). Equivalent to R's -.

      Parameters

      Returns number[] | number[][]

      subtract([[1, 2], [3, 4]], [10, 20]); // [[-9, -8], [-17, -16]]
      subtract([1, 2, 3], 2); // [-1, 0, 1]