It centers a numeric matrix with dimension N x N by row (rows=TRUE) or column (rows=FALSE).
Examples
dat <- matrix(rnorm(25),ncol=5,nrow=5)
centerX(dat)
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] -0.9553856 1.4178669 -1.5736245 0.7274453 0.3836978
#> [2,] 0.7216529 -0.3567449 -0.7980812 0.3183801 0.1147931
#> [3,] 0.3503425 -0.2759764 -0.9413944 1.5138252 -0.6467970
#> [4,] 1.4281815 -1.5649749 0.6310367 -0.8904160 0.3961727
#> [5,] 0.3153718 0.4870049 0.8592118 -1.4737129 -0.1878755