as.data.frame-methods | R Documentation |
~~ Methods for function as.data.frame
~~
## S4 method for signature 'magpie'
as.data.frame(x, rev = 1, raw = FALSE)
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. |
Conversion creates columns for Cell, Region, Year, Data1, Data2,... and Value
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.