magclass (version 6.13.2)

add_columns: add_columns

Description

Function adds new columns to the existing magpie object.

Usage

add_columns(x, addnm = "new", dim = 3.1, fill = NA)

Value

The extended MAgPIE object

Arguments

x

MAgPIE object which should be extended.

addnm

The new elements that should be added to the (sub)dimension

dim

The (sub)dimension to be filled either identified via name or dimension code (see dimCode for more information)

fill

fill value of length 1 for the newly added columns (NA by default)

Author

Jan Philipp Dietrich, Benjamin Bodirsky

See Also

add_dimension,dimCode

Examples

Run this code
a <- maxample("animal")
a2 <- add_columns(a, addnm = c("horse", "magpie"), dim = "species", fill = 42)
getItems(a2, dim = 3)
getItems(a2, dim = 3, split = TRUE)
head(a2[, , "magpie"])

Run the code above in your browser using DataLab