aperm.magpie: aperm method for magpie objects

View source: R/aperm.R

aperm.magpieR Documentation

aperm method for magpie objects

Description

Permutes the dimensions of a magpie object and returns a plain array. Since the magpie class has fixed dimension semantics (spatial, temporal, data), permuting the main dimensions produces an object that is no longer a valid magpie. This method therefore always returns a plain array.

Usage

## S3 method for class 'magpie'
aperm(a, perm = NULL, ...)

Arguments

a

A magpie object.

perm

An integer vector giving the new permutation of dimensions, or NULL for reverse order. See aperm.

...

Further parameters passed on to aperm.

Details

Use dimOrder to reorder sub-dimensions within a single main dimension while preserving the magpie class.

Value

A plain array (magpie class attribute dropped).

Author(s)

Patrick Rein

See Also

dimOrder, aperm

Examples

p <- maxample("pop")
a <- aperm(p, c(2, 1, 3))
class(a) # "array", not "magpie"

magclass documentation built on June 29, 2026, 5:06 p.m.