wgdx: Write R data to GDX

View source: R/gdxrrw.R

wgdxR Documentation

Write R data to GDX

Description

Create a GDX file containing the GAMS data described in the lists .... Note that each list describes a separate data element - i.e. a set or parameter - all of which are written to a single file.

Usage

  # generic form - each arg is a list specifying a symbol to write
  wgdx(gdxName, ..., squeeze = 'y')

  # write multiple symbols specified in list, data frame, or scalar form
  wgdx.lst(gdxName, ..., squeeze = 'y')

Arguments

gdxName

the name of the GDX file to write

...

zero or more arguments describing the symbols to write. For wgdx, each arg must be a list holding a symbol (e.g. as returned by rgdx). For wgdx.lst, each arg is also allowed to be a data frame holding a symbol (e.g. as returned by rgdx.param or rgdx.set), a scalar holding a symbol (e.g. as returned by rgdx.scalar), or a list containing any combination of these elements.

squeeze

if 'y'/TRUE/nonzero, squeeze out zeros: do not store in GDX. If 'n'/FALSE/zero, do not squeeze out zeros: store explicit zeros in GDX. If 'e', store zeros as EPS in the GDX.

Details

When writing sets, one can specify associated text for the set elements written to GDX. In most cases, it is clear what this aught to be: non-empty text strings are stored in GDX, and NA results in no associated text being stored. How to handle the empty string is less clear, so we use the gdx.inventSetText option introduced for rgdx to control wgdx also. In case options(gdx.inventSetText=F), we store an empty string as if no text had been provided, otherwise we store the empty string explicitly.

Note

A common problem is failure to load the external GDX libraries that are required to interface with GDX data. Use igdx to troubleshoot and solve this problem.

Author(s)

Original coding by Rishabh Jain. Adopted and packaged by Steve Dirkse. Maintainer: R@gams.com

See Also

igdx, rgdx, gdxInfo

Examples

  data(trnsport);
  wgdx("wgdx1.gdx",sf,si,sj,sa,sb,sd);

  ## Not run: 
    # complete tests and examples can be run in the
    # extdata directory of the gdxrrw package
    # check .libPaths for a hint on where packages are installed
    setwd(paste(.libPaths()[1],"/gdxrrw/extdata",sep=""))
    source("tAll.R")
  
## End(Not run)

GAMS-dev/gdxrrw-miro documentation built on July 11, 2024, 4:39 p.m.