Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

colVars

Column and row-wise variances and standard deviations of a matrix


Description

Column and row-wise variances and standard deviations of a matrix

Usage

colVars(x, suma = NULL, std = FALSE, na.rm = FALSE, parallel = FALSE)
rowVars(x, suma = NULL, std = FALSE, na.rm = FALSE, parallel = FALSE)

Arguments

x

A matrix with the data.

suma

If you already have the column sums vector supply it, otherwise leave it NULL. Depricated.

std

A boolean variable specyfying whether you want the variances (FALSE) or the standard deviations (TRUE) of each column.

na.rm

TRUE or FAlSE for remove NAs if exists.

parallel

Should parallel implentations take place in C++? The default value is FALSE.

Details

We found this on stackoverflow which was created by David Arenburg. We then modified the function to match the sums type formula of the variance, which is faster.

Value

A vector with the column variances or standard deviations.

Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris <mtsagris@yahoo.gr> and Manos Papadakis <papadakm95@gmail.com>.

See Also

Examples

x <- matrix( rnorm(100 * 100), ncol = 100 )
a2 <- colVars(x)
x<-a2<-NULL

Rfast

A Collection of Efficient and Extremely Fast R Functions

v2.0.1
GPL (>= 2.0)
Authors
Manos Papadakis, Michail Tsagris, Marios Dimitriadis, Stefanos Fafalios, Ioannis Tsamardinos, Matteo Fasiolo, Giorgos Borboudakis, John Burkardt, Changliang Zou, Kleanthi Lakiotaki and Christina Chatzipantsiou.
Initial release
2020-09-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.