colScale: Scale columns of a matrix

Description Usage Arguments Value Reference

View source: R/R-utils.R

Description

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

Usage

1
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.


mbr documentation built on Feb. 16, 2021, 5:07 p.m.