reordertensor: Permutation of indices and storage sequence of a tensor

Description Usage Arguments Details Value Author(s) See Also Examples

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

1
2
## 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

1
2
3
4
A <- to.tensor(1:20,c(A=2,B=2,C=5))
A
reorder(A,"C")
reorder(A,"B")

tensorA documentation built on Nov. 20, 2020, 9:07 a.m.