getYears: Get years

View source: R/getYears.R

getYearsR Documentation

Get years

Description

Extracts years of a MAgPIE-object

Usage

getYears(x, as.integer = FALSE)

getYears(x) <- value

setYears(object, nm = NULL)

Arguments

x, object

MAgPIE object

as.integer

Switch to decide, if output should be the used year-name (e.g. "y1995") or the year as integer value (e.g. 1995)

value, nm

Years the data should be set to. Either supplied as a vector of integers or a vector of characters in the predefined year format ("y0000"). If only 1 year exist you can also set the name of the year to NULL.

Details

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

Value

getYears returns years of the MAgPIE-object, whereas setYears returns the MAgPIE object with the manipulated years.

Functions

  • getYears(x) <- value: rename years

  • setYears(): set years

Author(s)

Jan Philipp Dietrich

See Also

getRegions, getNames, setNames, getCPR, read.magpie, write.magpie, "magpie"

Examples


 a <- as.magpie(1)
 getYears(a)
 setYears(a,1995)


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