as.data.frame-methods: ~~ Methods for Function as.data.frame ~~

as.data.frame-methodsR Documentation

~~ Methods for Function as.data.frame ~~

Description

~~ Methods for function as.data.frame ~~

Usage

## S4 method for signature 'magpie'
as.data.frame(x, rev = 1, raw = FALSE)

Arguments

x

A MAgPIE-object

rev

The revision of the algorithm that should be used for conversion. rev=1 creates columns with the predefined names Cell, Region, Year, Data1, Data2,... and Value, rev=2 uses the set names of the MAgPIE object for naming and adds an attribute "dimtype" to the data.frame which contains information about the types of the different columns (spatial, temporal, data or value), rev=3 is identical to rev=2 except that characters are not being converted to factors (stringsAsFactors = FALSE).

raw

Logical to control whether years beginning with "y" should be converted to integers (without "y") and coordinates should be converted to numerics. If set to raw columns are returned as they are in the initial object.

Methods

list("signature(x = \"magpie\")")

Conversion creates columns for Cell, Region, Year, Data1, Data2,... and Value

Examples


pop <- maxample("pop")
head(as.data.frame(pop))
head(as.data.frame(pop, rev = 2))

a <- maxample("animal")
head(as.data.frame(a, rev = 3))
head(as.data.frame(a, rev = 3, raw = TRUE))
attr(as.data.frame(a, rev = 3), "dimtype")


pik-piam/magclass documentation built on March 25, 2024, 11:07 p.m.