Rfast (version 1.7.3)

Column and row-wise means of a matrix: Column and row-wise means of a matrix

Description

Column and row-wise means of a matrix.

Usage

colmeans(x) rowmeans(x)

Arguments

x
A numerical matrix with data.

Value

A vector with column means or a column vector with the row means.

See Also

colsums, rowsums, colMins, colMedians, colMads

Examples

Run this code
x <- matrix(rpois(1000 * 1000,10),ncol = 1000)
x1 <- colmeans(x)
x2 <- colMeans(x)
all.equal(x1,x2)

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

Run the code above in your browser using DataLab