colVars: Column variances

Description Usage Arguments Value Author(s) See Also Examples

View source: R/colVars.R

Description

Form column variances for numeric arrays

Usage

1
colVars(x, na.rm = FALSE, dims = 1, unbiased = TRUE, SumSquares = FALSE, twopass = FALSE)

Arguments

x

A numeric array (or a dataframe to convert to a matrix)

na.rm

Logical: Remove NA's (not available values)

dims

Number of dimensions to sum over [colSums] or leave alone [rowSums]. Only useful when x is a multidimensional array

unbiased

Logical: Use (N-1) in the denominator when calculating variance

SumSquares

Logical: If TRUE, colVars just returns sums of squares.

twopass

Logical: If TRUE, colVars uses the corrected two-pass algorithm of Chan Golub & LeVeque, which is slower but less subject to roundoff error.

Value

A vector with the variance for every column.

Author(s)

colVars: Originally by Douglas Bates <bates@stat.wisc.edu> as package "MatUtils". Modified, expanded, and renamed by David Brahm <brahm@alum.mit.edu>, with help of course from the R-help gurus.

See Also

colMeans

Examples

1
2
3
4
5
6
mat <- cbind(rnorm(100, sd=sqrt(1)),
             rnorm(100, sd=sqrt(2)),
             rnorm(100, sd=sqrt(3)),
             rnorm(100, sd=sqrt(4)),
             rnorm(100, sd=sqrt(5)))
colVars(mat) 

asuR documentation built on May 2, 2019, 4:50 p.m.

Related to colVars in asuR...