Description Usage Arguments Details Value Examples
View source: R/p99_matrix_scaling_functions.R
This function is similar to the base::scale()
function. This function is
copied from the tutorial posted by user strictlystat on R-Bloggers.
Reference: https://www.r-bloggers.com/a-faster-scale-function/
1 2 3 4 5 6 7 8 |
x |
A matrix |
center |
Logical: whether to center each row by row mean or not. Default: TRUE |
scale |
Logical: scale each row by standard deviation or not. Default: TRUE |
add_attr |
Logical: whether to add attributes to scalled matrix. Default: FALSE |
rows |
Row indices if only a subset of rows need to be used. Default: NULL i.e. all rows are used |
cols |
Column indices if only a subset of columns needs to be used. Default: NULL i.e. all columns are used |
IMP: Remember that default base::scale()
function has different behaviour
when center == FALSE
. If center
is TRUE
, the scaling is done
by dividing centered columns of x by standard deviation. If center
is
FALSE
, the root mean square of column. Refer to scale
for details.
A row scaled matrix
1 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.