Learn R Programming

kerntools (version 1.2.0)

centerX: Centering a squared matrix by row or column

Description

It centers a numeric matrix with dimension N x N by row (rows=TRUE) or column (rows=FALSE).

Usage

centerX(X, rows = TRUE)

Value

Centered X (class "matrix").

Arguments

X

Numeric matrix or data.frame of any size.

rows

If TRUE, the operation is done by row; otherwise, it is done by column. (Defaults: TRUE).

Examples

Run this code
dat <- matrix(rnorm(25),ncol=5,nrow=5)
centerX(dat)

Run the code above in your browser using DataLab