colScale {mbr}R Documentation

Scale columns of a matrix

Description

Same as base::scale() but much faster.

Usage

colScale(x, add_attr = TRUE)

Arguments

x

A matrix.

add_attr

If TRUE, the column means and standard deviations are returned as attributes. This is consistent with base::scale().

Value

The scaled matrix.

Reference

This function was adopted from John Muschelli's code on StackOverflow, but I changed the underlying functions to calculate mean and standard deviation from matrixStats to Rfast, which is much faster.


[Package mbr version 0.0.1 Index]