tensorA (version 0.36.1)

reorder.tensor: Permutation of indices and storage sequence of a tensor

Description

This permutes tensor dimensions like aperm. However the interface is more flexible since not all dimensions have to given and names can be used instead of numbers.

Usage

# S3 method for tensor
reorder(x,i=NULL,...,by=NULL)

Arguments

x

the tensor

i

numeric or character giving dimensions intended to come first

further arguments to other instances of the generic function

by

the complement of i, if i is not given

Value

reorder.tensor returns a tensor equal to x but stored with a different sequence of dimensions.

Details

the remaining dimensions keep their relative sequence and follow at the end of the dimension attribute.

See Also

to.tensor

Examples

Run this code
# NOT RUN {
A <- to.tensor(1:20,c(A=2,B=2,C=5))
A
reorder(A,"C")
reorder(A,"B")
# }

Run the code above in your browser using DataLab