apply_axes: Apply a function over specified array axes.

View source: R/utils.R

apply_axesR Documentation

Apply a function over specified array axes.

Description

Apply a function over specified array axes.

Usage

apply_axes(x, axes, fun, ...)

Arguments

x

an array.

axes

a vector of axes to apply fun over.

fun

function to be applied.

...

optional arguments to fun.

Value

array.

Examples

z <- array(1:1000, dim = c(10, 10, 10))
a <- apply_axes(z, 3, fft)
a[1,1,] == fft(z[1,1,])
a <- apply_axes(z, 3, sum)
a[1,1,] == sum(z[1,1,])

spant documentation built on Oct. 23, 2023, 5:06 p.m.