colmeans: Column and row-wise means of a matrix

View source: R/mean.R

Column and row-wise means of a matrixR Documentation

Column and row-wise means of a matrix

Description

Column and row-wise means of a matrix.

Usage

colmeans(x, parallel = FALSE, cores = 0)
## S3 method for class 'matrix'
colmeans(x, parallel = FALSE, cores = 0)
## S3 method for class 'data.frame'
colmeans(x, parallel = FALSE, cores = 0)
rowmeans(x)
colhameans(x, parallel = FALSE)
rowhameans(x)

Arguments

x

A numerical matrix or data.frame with data.

parallel

Do you want to do it in parallel in C++? TRUE or FALSE.

cores

Number of cores to use for parallelism. Valid only when argument parallel is set to TRUE. Default value is 0 and it means the maximum supported cores.

Value

A vector with the column or row arithmetic or harmonic means.

Author(s)

Manos Papadakis

R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.

See Also

colsums, rowsums, colMins, colMedians, colMads

Examples

x <- matrix(rpois(100 * 100, 10),ncol = 100)
x1 <- colmeans(x)
#x2 <- colMeans(x)
#all.equal(x1,x2)

x1 <- rowmeans(x)
#x2 <- rowMeans(x)
#all.equal(x1,x2)

colhameans(x)
rowhameans(x) 

x<-x1<-x2<-NULL

Rfast documentation built on Nov. 9, 2023, 5:06 p.m.