matchDim: Match dimensions of a magpie object to those of a reference...

View source: R/matchDim.R

matchDimR Documentation

Match dimensions of a magpie object to those of a reference object

Description

A helper that restricts and expands a magpie object x to the size of a magpie object ref. Dimension names not present in x are added and set to the value provided by fill. Dimension names not present in ref are cropped.

Usage

matchDim(x, ref, dim = 1:3, fill = NA)

Arguments

x

A magpie object to be modified.

ref

A magpie object used as a reference for the modification. Returns x if ref is NULL.

dim

Subset of dimensions for which the matching should be done. Can be either a number between 1 and 3 or a vector of these. Defaults to all dimensions (i.e. 1:3).

fill

Value to be set in new dimensions.

Value

The modified magpie object.

Author(s)

Falk Benke


pik-piam/magclass documentation built on June 2, 2025, 9:31 a.m.