rray_mean: Calculate the mean along an axis

Description Usage Arguments Value See Also Examples

View source: R/reducers.R

Description

rray_mean() computes the mean along a given axis or axes. The dimensionality of x is retained in the result.

Usage

1
rray_mean(x, axes = NULL)

Arguments

x

A vector, matrix, or array to reduce.

axes

An integer vector specifying the axes to reduce over. 1 reduces the number of rows to 1, performing the reduction along the way. 2 does the same, but with the columns, and so on for higher dimensions. The default reduces along all axes.

Value

The result of the reduction as a double with the same shape as x, except along axes, which have been reduced to size 1.

See Also

Other reducers: rray_max(), rray_min(), rray_prod(), rray_sum()

Examples

1
2
3
4
5
6
7
x <- rray(1:10, c(5, 2))

rray_mean(x)

rray_mean(x, 1)

rray_mean(x, 2)

DavisVaughan/rray documentation built on Feb. 5, 2020, 10:06 p.m.