Examples for 'matrixStats::rowDiffs'


Calculates difference for each row (column) in a matrix

Aliases: rowDiffs colDiffs

Keywords: array iteration robust univar

### ** Examples

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

d1 <- rowDiffs(x)
print(d1)
      [,1] [,2]
 [1,]    9    9
 [2,]    9    9
 [3,]    9    9
 [4,]    9    9
 [5,]    9    9
 [6,]    9    9
 [7,]    9    9
 [8,]    9    9
 [9,]    9    9
d2 <- t(colDiffs(t(x)))
stopifnot(all.equal(d2, d1))

[Package matrixStats version 1.4.1 Index]