Learn R Programming

proxyC (version 0.5.0)

colSds: Standard deviation of columns and rows of large matrices

Description

Produces the same result as apply(x, 1, sd) or apply(x, 2, sd) without coercing matrix to dense matrix. Values are not identical to sd() because of the floating point precision issue in C++.

Usage

colSds(x)

rowSds(x)

Arguments

x

a base::matrix or Matrix::Matrix object.

Examples

Run this code
mt <- Matrix::rsparsematrix(100, 100, 0.01)
colSds(mt)
apply(mt, 2, sd) # the same

Run the code above in your browser using DataLab