incl/rowDiffs.R

x <- matrix(1:27, ncol = 3)

d1 <- rowDiffs(x)
print(d1)

d2 <- t(colDiffs(t(x)))
stopifnot(all.equal(d2, d1))
HenrikBengtsson/matrixStats documentation built on Aug. 28, 2023, 5:42 a.m.