colscale: Scaling and Centering by Row or Column Based on Grouping

colscaleR Documentation

Scaling and Centering by Row or Column Based on Grouping

Description

Apply the equivalent of scale to either columns or rows of a matrix, using a grouping variable.

Usage

## S4 method for signature 'ANY'
colscale(x, center=TRUE, scale=TRUE,
    group = NULL, ..., BPPARAM = bpparam())

## S4 method for signature 'ANY'
rowscale(x, center=TRUE, scale=TRUE,
    group = NULL, ..., BPPARAM = bpparam())

Arguments

x

A matrix-like object.

center

Either a logical value or a numeric vector of length equal to the number of columns of 'x' (for colscale()) or the number of the rows of 'x' (for rowscale()). If a grouping variable is given, then this must be a matrix with number of columns equal to the number of groups.

scale

Either a logical value or a numeric vector of length equal to the number of columns of 'x' (for colscale()) or the number of the rows of 'x' (for rowscale()). If a grouping variable is given, then this must be a matrix with number of columns equal to the number of groups.

group

A vector or factor giving the groupings with length equal to the number of rows of 'x' (for colscale()) or the number of the columns of 'x' (for rowscale()).

...

Arguments passed to rowStats() or colStats() respectively, if center or scale must be calculated.

BPPARAM

An optional instance of BiocParallelParam. See documentation for bplapply.

Details

See scale for details.

Value

A matrix-like object (usually of the same class as x) with either ‘col-scaled:center’ and ‘col-scaled:scale’ attributes or ‘row-scaled:center’ and ‘row-scaled:scale’ attributes.

Author(s)

Kylie A. Bemis

See Also

scale

Examples

x <- matter(1:100, nrow=10, ncol=10)

colscale(x)

kuwisdelu/matter documentation built on Oct. 19, 2024, 10:31 a.m.