R: Permutation of indices and storage sequence of a tensor
reorder.tensor
R Documentation
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 class '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
Details
the remaining dimensions keep their relative sequence and follow at
the end of the dimension attribute.
Value
reorder.tensor returns a tensor equal to x but stored with a different
sequence of dimensions.
Author(s)
K.Gerald v.d. Boogaart
See Also
to.tensor
Examples
A <- to.tensor(1:20,c(A=2,B=2,C=5))
A
reorder(A,"C")
reorder(A,"B")