Calculates difference for each row (column) in a matrix
Calculates difference for each row (column) in a matrix.
rowDiffs(x, rows = NULL, cols = NULL, lag = 1L, differences = 1L, dim. = dim(x), ...) colDiffs(x, rows = NULL, cols = NULL, lag = 1L, differences = 1L, dim. = dim(x), ...)
x |
|
rows, cols |
A |
lag |
An |
differences |
An |
dim. |
An |
... |
Not used. |
Henrik Bengtsson
See also diff2
().
x <- matrix(1:27, ncol = 3) d1 <- rowDiffs(x) print(d1) d2 <- t(colDiffs(t(x))) stopifnot(all.equal(d2, d1))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.