gperm: Generalized Array Permutation

Description Usage Arguments Details Value Examples

Description

Permute and collapse the dimensions of an array

Usage

1
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

1
2
3
4
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)))

KateGoodenough/RoL-SGAT documentation built on June 11, 2019, 1:29 p.m.