colmeans: Column and row-wise means of a matrix

Description Usage Arguments Value Author(s) See Also Examples

View source: R/mean.R

Description

Column and row-wise means of a matrix.

Usage

1
2
3
4

Arguments

x

A numerical matrix with data.

parallel

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

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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)
system.time( colhameans(x) )
system.time( rowhameans(x) ) 

x<-x1<-x2<-NULL

Example output

Loading required package: Rcpp
Loading required package: RcppZiggurat
[1] TRUE
[1] TRUE
   user  system elapsed 
      0       0       0 
   user  system elapsed 
      0       0       0 

Rfast documentation built on May 18, 2021, 1:07 a.m.