Learn R Programming

magclass (version 6.13.2)

getNames: Get dataset names

Description

Extracts dataset names of a MAgPIE-object

Usage

getNames(x, fulldim = FALSE, dim = NULL)

getNames(x, dim = NULL) <- value

Value

getNames returns data names of the MAgPIE-object, whereas setNames returns the MAgPIE object with the manipulated data names.

Arguments

x

MAgPIE object

fulldim

specifies, how the object is treated. In case of FALSE, it is assumed that x is 3 dimensional and dimnames(x)[[3]] is returned. In case of TRUE, the dimnames of the real third dimension namesare returned

dim

Argument to choose a specific data dimension either by name of the dimension or by number of the data dimension.

value

a vector of names current names should be replaced with. If only one data element exists you can also set the name to NULL.

Functions

  • getNames(x, dim = NULL) <- value: set names

Author

Jan Philipp Dietrich

Details

setNames is a shortcut to use a MAgPIE object with manipulated data names. The setNames method uses the variable names "object" and "nm" in order to be consistent to the already existing function setNames.

See Also

setNames-methods, getRegions, getYears, getCPR, read.magpie, write.magpie,ndata, "magpie"

Examples

Run this code

a <- as.magpie(1)
getNames(a)
setNames(a, "bla")

x <- new.magpie("GLO", 2000, c("a.o1", "b.o1", "a.o2"))
getNames(x, dim = 2)

getSets(x, fulldim = FALSE)[3] <- "bla.blub"
getNames(x, dim = "bla")

getSets(x)[4] <- "ble"
getNames(x, dim = "ble") <- c("Hi", "Bye")
x

Run the code above in your browser using DataLab