Permutes the axes of an array. You can also use t() for matrices.
Arguments
- x
(
arrayish)
One input. Can be any data type. An R value materializes at its default data type.- permutation
(
integer()|NULL)
New ordering of axes. IfNULL(default), reverses the axes. Negative values count from the end, i.e.-1refers to the last axis.
Value
(arrayish)
Has x's data type and shape shape(x)[permutation], or rev(shape(x))
when permutation is NULL.
The t() generic
t() requires a matrix, whereas base::t() also transposes a vector (into
a one-row matrix) and reverses the axes of a higher-rank array.
See also
prim_transpose() for the underlying primitive.