[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Data frames ?
John W. Eaton
Re: Data frames ?
Mon, 29 Oct 2007 13:37:34 -0400
On 29-Oct-2007, David Bateman wrote:
| depuis wrote:
| > Hello,
| > I recently dived into code I wrote a few months ago ... and had a hard time
| > remembering what contained a matrix.
| > A possible solution to this kind of annoyance would be to implement
| > similar to R "data frames". Such object is a matrix where lines and columns
| > have associated name. This way, matrix would be self-documented. This would
| > also help reading data headers, i.e. column names
| > Coding implications:
| > 1) modify the basic matrix object
| > 2) modify the print and display routines
| > 3) at the user level : either follow the R paradigm: df$var is the column
| > named 'var' of the df data frame, or define some function : x = getcol(df,
| > "var") returning the column named "var" of df. Define also functions similar
| > to fieldnames: colnames & linenames
| > What do you think about it ?
| > Pascal Dupuis
| > ---
| This would be fairly trivial to add as it would just be a derived class
| of the basic matrix class, and all the basic matrix operators could take
| precedence.. However, in that case the dimensions of the matrix would
| loose their names during a function or operator, is this what you want?
| Or do the dimensions have to have the same name to allow the function or
| operator to be completed.. If the first case is ok, then the triangular
| type in Octave-forge is a good example of how to implement this quite
I think that if you want to do this kind of thing, it would be best to
just add property lists to variables. Then property lists could hold
arbitrary information, not just column (row?, Nth-dimension?) labels.
It seems to me that these should apply to variables in the symbol
table, or possibly the octave_value object, not the underlying Matrix
or other data structures.
An immediate problem is that property lists could not be saved to MAT
files, and we would have to modify Octave's own data file formats to
save and load them. That would cause some backward compatibility