gperm: Generalized Array Permutation

View source: R/SGAT.R

gpermR Documentation

Generalized Array Permutation

Description

Permute and collapse the dimensions of an array

Usage

gperm(x, perm)

Arguments

x

an array.

perm

the subscript permutation list.

Details

Like aperm this function permutes the dimensions of an array, but can also collapse adjacent dimensions. The permutation of dimensions is specified by a list of vectors. The index of each dimension must appear exactly once, but dimensions that occur together in a vector are reduced to a single dimension.

Value

The redimensioned array.

Examples

x <- array(1:120,2:5)
dim(gperm(x,list(4,3,2,1)))
dim(gperm(x,list(c(4,3),2,1)))
dim(gperm(x,list(1,c(3,2),4)))


SWotherspoon/SGAT documentation built on June 1, 2022, 10:49 p.m.