map: Maps a function along an array preserving its structure

View source: R/map.r

mapR Documentation

Maps a function along an array preserving its structure

Description

Maps a function along an array preserving its structure

Usage

map(X, along, FUN, subsets = base::rep(1, dim(X)[along]), drop = TRUE,
  ...)

Arguments

X

An n-dimensional array

along

Along which axis to apply the function

FUN

A function that maps a vector to the same length or a scalar

subsets

Whether to apply FUN along the whole axis or subsets thereof

drop

Remove unused dimensions after mapping; default: TRUE

...

Other arguments passed to FUN

Value

An array where FUN has been applied


mschubert/narray documentation built on Jan. 12, 2023, 8:26 a.m.