add_dimension: add_dimension

View source: R/addDim.R

add_dimensionR Documentation

add_dimension

Description

This function adds a named dimension as dimension number "dim" with the name "add" with an empty data column with the name "nm". Please start using this function's successor addDim. add_dimension might eventually become deprecated.

Usage

add_dimension(x, dim = 3.1, add = NULL, nm = "dummy", expand = TRUE)

Arguments

x

MAgPIE object which should be extended.

dim

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

add

The name of the new dimension

nm

One or more names of items in the new dimension.

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.