Learn R Programming

gdxdt (version 0.1.0)

writegdx.variable: writegdx.variable

Description

Save a data.table to a variable in a GAMS gdx file.

Usage

writegdx.variable(gdx, dt, name, valcol, uelcols, field = "l")

Arguments

gdx

the gdx filename.

dt

a data.table.

name

name of the variable.

valcol

name of data column.

uelcols

vector of column names with index dimensions.

field

the field if `type == 'variable'`

Examples

Run this code
# NOT RUN {
dt <- as.data.table(mtcars, keep.rownames = TRUE)
tmpgdx <- file.path(tempdir(), "test.gdx")
test_var <- "mtcars"
writegdx.variable(tmpgdx, dt, test_var, valcol="wt", uelcols="rn", field="l")
new_dt <- readgdx(tmpgdx, test_var)
# }

Run the code above in your browser using DataLab