[Gretl-users] WG: append horizontal and vertical

Schaff, Frederik Frederik.Schaff at fernuni-hagen.de
Tue Sep 19 09:24:05 EDT 2017


> Am 19.09.2017 um 11:36 schrieb Schaff, Frederik:
> 
> > I am trying to load a bunch of data into gretl, with a structure
> > similar to the attached files (time 1600), i.e. I have horizontal and
> > vertical appending at the same time. I basically use a script that
> > opens the first file (like parameters_1.tsv) and then via a loop
> > appends all the other files. However, the horizontal appending works
> > only for the first files (belonging to *_1.tsv) and even there not
> > completely,
> 
> OK, this is only a generic answer, sorry: First, I don't exactly understand what
> you mean with "horizontal" or "vertical". Second, for more general dataset
> handling there's also the 'join' command in addition to append. Maybe that's
> what you need.
> 
> cheers,
> sven
> 

Ok, I guess the script and files attached are self-explanatory, but I'll try to explain it without them.

I have a set of files with multiple columns and (currently) two lines - head and data. The First column always holds a common key, the next columns hold several different metrics. 

Horizontal merging means that there are several files that contain information on the same "record" which is specified by the key in the first column. In other words, the data belonging to a single record is split in several files. 

Vertical appending means that there are several files for different records, also.

The "join" command would, I guess, work. But from what I understand, I need to explicitly name all the single columns I want to import.

Alternatively, if there was a command / operation to ... clean-up (?) the mess that is currently generated, that would also help.

The database I get currently looks like the following:

..................................................................................................
: Common Key : file1-data1 : file1-data2 : file2-data3 : file2-data4 : file3-data1 : file3-data2 :
:............:.............:.............:.............:.............:.............:.............:
: 1          : data        : data        :             :             :             :             :
: 1          :             :             : data        : data        : data        : data        :
: 2          : data        : data        :             :             :             :             :
: 2          :             :             : data        : data        :             :             :
: 2          :             :             :             :             : data        : data        :
:............:.............:.............:.............:.............:.............:.............:



More information about the Gretl-users mailing list