addDim: addDim

View source: R/addDim.R

addDimR Documentation

addDim

Description

This function adds a named dimension as dimension number "dim" with the name "dimName" with an empty data column with the name "item".

Usage

addDim(x, dim = 3.1, dimName = NULL, item = "dummy", expand = TRUE)

Arguments

x

MAgPIE object which should be extended.

dim

The dimension number of the new dimension (e.g. 3.1)

dimName

The name of the new dimension

item

One or more names of items in the new dimension. If more than one is given, behavior depends on the expand argument.

expand

If TRUE, each item from the item argument is added to each item already present, resulting in e.g. 'c("A.d1", "B.d1", "A.d2", "B.d2")'. Otherwise, length of item must equal the number of items already present and they are simply added, resulting in e.g. 'c("A.d1", "B.d2")'.

Value

The extended MAgPIE object

Author(s)

Jan Philipp Dietrich, Benjamin Bodirsky, Pascal Sauer

See Also

add_columns,mbind

Other DimensionManipulation: add_columns(), collapseDim(), collapseNames(), dimCode(), dimOrder(), dimReduce()

Examples


a <- maxample("animal")
str(addDim(a, dim = 3.2))
str(addDim(a, dim = 2.3, item = paste0("d", 1:3)))

magclass documentation built on April 17, 2026, 5:07 p.m.