# colVars: Form Row and Column Variances In rmngb: Miscellaneous Collection of Functions for Medical Data Analysis

## Description

Form row and column variances for numeric arrays.

## Usage

 ```1 2 3 4``` ```colVars(x, na.rm = FALSE, dims = 1, unbiased = TRUE, SumSquares = FALSE, twopass = TRUE) rowVars(x, na.rm = FALSE, dims = 1, unbiased = TRUE, SumSquares = FALSE, twopass = TRUE) ```

## Arguments

 `x` an array of two or more dimensions, containing numeric, complex, integer or logical values, or a numeric data frame. `na.rm` logical. Should missing values (including NaN) be omitted from the calculations? `dims` integer: Which dimensions are regarded as ?rows? or ?columns? to sum over. For row*, the sum or mean is over dimensions dims+1, ...; for col* it is over dimensions 1:dims. `unbiased` logical. Should the estimator of the variance be unbiaised, using '(N - 1)' as a denominator? `SumSquares` logical. Should the function return only the sum of squares? `twopass` logical. 'twopass = TRUE' is needed for numerical accuracy if mu >> sigma.

## Details

These functions are equivalent to use of apply with 'FUN = var' with appropriate margins, but are a lot faster.

## Value

A numeric or complex array of suitable size, or a vector if the result is one-dimensional. For the first four functions the dimnames (or 'names' for a vector result) are taken from the original array.

## Author(s)

Antoine Filipovic Pierucci

## References

From David Brahm on R-Help, inspired from Package "colSums".

`colSums`, `apply`.
 ```1 2 3``` ```x <- cbind(x1 = 3, x2 = c(4:1, 2:5)) rowVars(x); colVars(x) # more examples should be included for the other arguments ```