Thursday, September 18, 2014

Data manipulation in GAMS, R or SQL

When moving data from GAMS to R via SQLite we have three possible spots where we can apply some data manipulation:

image

Suppose we want to plot some data but need to do:

image

Here is the code in GAMS:

image

I could do the same thing in R, but the code is slightly more messy:

image

The final attempt is in SQL, which is not too bad either (but with nested queries more complicated than the GAMS version):

image 

In all cases we did not use any loops.

No comments:

Post a Comment