Learn R Programming

spatstat.sparse (version 3.1-0)

aperm.sparse3Darray: Transposition of Sparse Array

Description

Transpose a sparse three-dimensional array by permuting its dimensions.

Usage

# S3 method for sparse3Darray
aperm(a, perm = NULL, resize = TRUE, ...)

Value

Another sparse three-dimensional array (object of class "sparse3Darray").

Arguments

a

A sparse three-dimensional array (object of class "sparse3Darray").

perm

The subscript permutation vector, a permutation of the integers 1:3.

resize

Logical value specifying whether the dimensions and dimnames of the array should also be adjusted, by permuting them according to the permutation.

...

Ignored.

Author

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner rolfturner@posteo.net and Ege Rubak rubak@math.aau.dk.

Details

The function aperm is generic. This is the method for the class "sparse3Darray" of sparse three-dimensional arrays.

See Also

sparse3Darray, tensorSparse.

Examples

Run this code
  M <- sparse3Darray(i=1:4, j=sample(1:4, replace=TRUE),
                     k=c(1,2,1,2), x=1:4, dims=c(5,7,2))
  dim(M)
  P <- aperm(M, c(3,1,2))
  dim(P)

Run the code above in your browser using DataLab