readGDX | R Documentation |
Function to read gdx files in R. It is partly a reimplementation of readGDX which is now based on magclass structures rather than array structures.
readGDX(
gdx,
...,
types = c("sets", "equations", "parameters", "variables", "aliases"),
field = "All",
format = "simplest",
restore_zeros = TRUE,
react = "warning",
spatial = NULL,
temporal = NULL,
select = NULL,
collapseNames = TRUE,
magpie_cells = TRUE
)
gdx |
Either file name of a gdx file or an already read in gdx (in the latter case readGDX just acts as a filter. This can be useful if you want to apply several functions on the same gdx file. In that case you could read in the gdx first and then filter the data you need using readGDX.) |
... |
search strings defining the objects that should be read from gdx file, with *-autocompletion. Can also be vectors containing more than one search strings |
types |
Types of objects that should be extracted. Available options are "sets", "equations", "parameters", "variables" and "aliases". |
field |
Defining what kind of information should be returned. "All" means all available data. Other options are "l" (level value), "m" (marginal), "lo" (lower bound), "up" (upper bound) and "s" (scaling factor). In the case that the level value is not part of the field value (all options other than "All" and "l") only data for equations and variables are returned as all other types do not have this kind of information. WARNING: field has to be set to "All" if the data is planned to be written back to a GDX. Otherwise writeGDX will not work! |
format |
Output format. Five choices are currently available
|
restore_zeros |
Defines whether 0s, which are typically not stored in a gdx file, should be restored or ignored in the output. By default they will be restored. If possible, it is recommended to use restore_zeros=TRUE. It is faster but more memory consuming. If you get memory errors you should use restore_zeros=FALSE |
react |
determines the reaction, when the object you would like to read in does not exist. Available options are "warning" (NULL is returned and a warning is send that the object is missing), "silent" (NULL is returned, but no warning is given) and "error" (The function throws out an error) |
spatial |
argument to determine the spatial columns in the dataframe to
be converted to a magclass object. Defaults to NULL.
See |
temporal |
argument to determine the temporal columns in the dataframe to
be converted to a magclass object. Defaults to NULL.
See |
select |
preselection of subsets in the data coming from the gdx using
the function |
collapseNames |
Boolean which determines whether collapseNames should
be applied in |
magpie_cells |
(boolean) determines whether a set "j" gets special treatment by replacing underscores in the set elements with dots. Active by default for historical reasons. Can be ignored in most cases. Makes only a difference, if 1) GDX element depends on set "j", 2) set "j" contains underscores. |
The gdx objects read in the format set with the argument
format
.
Jan Philipp Dietrich
writeGDX
, mselect
## Not run:
readGDX("bla.gdx", "blub*")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.