Learn R Programming

nandb (version 0.2.1)

ApplyOnPillars: Apply a function to each pillar of a 3-dimensional array.

Description

Define a 'pillar' of a 3-dimensional array as pillar i,j off array arr being arr[i, j, ]. This function applies a specified function to each pillar.

Usage

ApplyOnPillars(mat3d, FUN)

Arguments

mat3d

A 3-dimensional array.

FUN

A function which takes a vector as imput and, for a given input length, outputs a vector of constant length (can be 1).

Value

If FUN is returning length 1 vectors, a matrix whereby mat[i, j] = FUN(mat3d[i, j, ]). If FUN is returning vectors of length l > 1, a 3-dimensional array whereby arr[i, j, ] = FUN(mat3d[i, j, ]).