Scales each row of a matrix such that the values in this row have
zero mean and a standard deviation of 1.
Usage
rowScales(X, add.stats = FALSE)
Arguments
X
a numeric matrix whose rows should be scaled. Missing values are allowed.
add.stats
should the rowwise means and standard deviations of X
be returned?
Value
If add.stats = FALSE, a matrix of the same dimensions as X
with a rowwise mean of zero and a rowwise standard deviation of 1.
If add.stats = TRUE, a list containing this matrix and the
rowwise means and standard deviations of the input matrix.
# NOT RUN {# Generate a matrix containing data for 10 categorical # variables with levels 1, 2, 3.mat <- matrix(sample(3, 500, TRUE), 10)
rowScales(mat)
# }