dimReduce: dimReduce

View source: R/dimReduce.R

dimReduceR Documentation

dimReduce

Description

Remove dimensions which contain identical data for all elements in it

Usage

dimReduce(x, dim_exclude = NULL)

Arguments

x

MAgPIE object which should be reduced

dim_exclude

Vector with names of dimensions which must not be reduced

Value

The reduced MAgPIE object

Note

This function has some similarities to collapseDim, but serves a different purpose. While collapseDim only removes dimensions which contain only a single element or which it is specifically told to remove, dimReduce looks whether the entries of a multi-entry dimension are all the same and removes dimensions for which this is the case. In some cases both will lead to the same result but in many other cases the results will differ.

Author(s)

Jan Philipp Dietrich

See Also

add_dimension

Examples


# create data with 5 identical scenarios
p <- add_dimension(maxample("pop")[1:3, 1:3, ], nm = paste0("scen", 1:2))
str(p)
str(dimReduce(p))

# set years to same value
p[, , ] <- setYears(p[, 1, ], NULL)
str(p)
str(dimReduce(p))

# set regions to same value
p[, , ] <- setCells(p[1, , ], "GLO")
str(p)
str(dimReduce(p))

magclass documentation built on May 29, 2024, 6:20 a.m.