add_columns: add_columns

View source: R/add_columns.R

add_columnsR Documentation

add_columns

Description

Function adds new columns to the existing magpie object.

Usage

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

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)

Value

The extended MAgPIE object

Author(s)

Jan Philipp Dietrich, Benjamin Bodirsky

See Also

add_dimension,dimCode

Examples

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"])

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