R: Write R data to GDX

wgdx {gdxrrw} | R 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 a data frame - inverse of \code{rgdx.param} and \code{rgdx.set}
      wgdx.df(gdxName, df, squeeze = 'y')

      # write a scalar - inverse of \code{rgdx.scalar}
      wgdx.scalar(gdxName, s)

      # write multiple symbols
      wgdx.lst(gdxName, ilst, squeeze = 'y')

### Arguments

`gdxName` | the name of the GDX file to write
`...` | zero or more lists describing the sets and parameters to write
`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.
`df` | data frame to write to GDX
`s` | scalar to write to GDX
`ilst` | list of inputs, each of which can be a data frame as returned by `rgdx.param` or `rgdx.set`, a scalar as returned by `rgdx.scalar`, or a symbol list as required for input to `wgdx`

### 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.

The routines `wgdx.df` and `wgdx.scalar` are experimental and perhaps temporary. Don't use them for production work.

### 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)

[Package gdxrrw version 0.2.0 Index]