I am requesting an enhancement to allow for the display of multiline column and row labels when working with matrices.
Currently, gretl only displays the first 12 letters of any column and 20 letters of any row label. This can be problematic when working with longer descriptive labels, as the full context of the label is lost. Here an illustration of the current restriction:
matrix m = ones(1,1)
string label = "12345678901234567890"
cnameset(m, label)
rnameset(m, label)
print m
Here is an example output showing that some label gets cut:
airco prefarea count mean(price) mean(lotsize min(price) min(lotsize) max(price) max(lotsize)
0.0000 0.0000 298.00 56524. 4617.7 25000. 1650.0 1.4500e+05 16200.
0.0000 1.0000 75.000 73240. 5639.3 44555. 1950.0 1.7500e+05 12090.
1.0000 0.0000 120.00 80001. 5492.5 37900. 2175.0 1.7500e+05 15600.
1.0000 1.0000 53.000 99193. 6677.9 31900. 2275.0 1.9000e+05 13200.
I propose adding the capability to support multiline labels that can be attached to the columns and possibly rows of a matrix. This would allow users to provide more detailed and informative labels, without being constrained by the character limit.
The benefits of this feature would be:
How could that be implemented? Maybe its possible to make the newline operator, \n, available for string arrays:
strings labels = defarray("mean\n of some \n variable", "min", "max")
Best
Artur
A couple of comments. On newlines in strings arrays, that's supported:
On supporting long column names in matrix printout, I'd say no. It's not at all clear what such a printout should look like. If I had to do this my inclination would be to label the columns as A, B, C, etc (or similar) and precede the actual matrix print with a key:
A = some relatively long description of the first column
B = some other long thing about the second
C = some even longer and fuller description pertaining to the third
and so on. Unless perhaps the matrix had very few columns and the strings were not all that long. Anyway, I can't see any one approach satisfying all customers, and it's easy enough to do this the way you want with hansl tools.
Thanks for your comment(s), Allin.
Ah, that's good to know.
Here is an example of what I have in mind. The labels for the columns 3 and 4 for comprise a single line break:
OK, I see what you mean. That could work if each line of each label were reasonably short.
We discussed this some more, and a problem there is the fact that adding newline characters into the labels mixes up the content and the (intended) formatting. The newlines would have unintended side effects when you want to extract or work with the labels afterwards in some other way.
What @atecon wants to achieve, apparently, is to be able to pretty-print the matrix along with its labels. So the idea is that "somebody" can write a hansl function (possibly in the extra addon) that does that. Of course it's going to be a bit tedious to get the formatting right, but the same caveat applies to the requested fully native implementation.
Thanks for the summary. It's a pity that newlines have such side-effects.
Ok, maybe I can come up with some function candidate to realize this request in near future. I think, this ticket can be closed now.
OK, I'm closing this as suggest by Artur.