Skip to main content

builtin_aperm

Function builtin_aperm 

Source
fn builtin_aperm(
    args: &[RValue],
    named: &[(String, RValue)],
) -> Result<RValue, RError>
Expand description

Transpose or permute the dimensions of an array.

For 2D arrays (matrices), this is equivalent to t(). For higher-dimensional arrays, perm specifies the new ordering of dimensions. By default, perm reverses the dimensions (i.e. for a 3D array with dims (a,b,c), the default permutation is c(3,2,1) giving dims (c,b,a)).

@param a an array (vector with dim attribute) @param perm integer vector specifying the new dimension order (1-based) @return array with permuted dimensions