diffrows: Differences between Matrix Rows

View source: R/matrix.R

diffrowsR Documentation

Differences between Matrix Rows

Description

Differences between Matrix Rows

Usage

diffrows(x)

Arguments

x

matrix

Value

matrix with one row less than in input matrix x and each row i representing the difference x[i+1, ]-x[i, ] between rows i+1 and i in x

Examples

x <- matrix(1:12, nrow = 3)

d <- diffrows(x)

x[2, ] - x[1, ] == d[1, ]
x[3, ] - x[2, ] == d[2, ]


KWB-R/kwb.utils documentation built on April 1, 2024, 7:12 a.m.