Var: Efficiently compute row-wise or column-wise variance of a...

Description Usage Arguments Value Examples

View source: R/Var.R

Description

Reproduced from David Arenburg's answer here: https://stackoverflow.com/questions/25099825/row-wise-variance-of-a-matrix-in-r

Usage

1
Var(x, dim = 1, ...)

Arguments

x

N by P numeric matrix

dim

dimension along which to compute variance (1 == row, 2 == col)

...

(optional) arguments for rowSums/colMeans calls (e.g., na.rm)

Value

a vector containing the variances

Examples

1
2
3
x <- row(matrix(0, 3, 4))
length(Var(x)) == nrow(x)
length(Var(x, 2)) == ncol(x)

mcfreund/mfutils documentation built on Feb. 6, 2022, 4:57 a.m.