On Mon, 9 Sep 2019, Artur Tarassow wrote:
Am 08.09.19 um 17:00 schrieb Allin Cottrell:
> On Sun, 8 Sep 2019, Artur Tarassow wrote:
>
>> Am 08.09.19 um 00:41 schrieb Allin Cottrell:
>>> On Sat, 7 Sep 2019, Artur Tarassow wrote:
>>>
>>>> it's cool that row or column names of matrices remain intact when
>>>> applying
>>>> the msortby() function.
>>>>
>>>> However, when applying row or column selection by means of selifr() or
>>>> selifc() destroys the attached labels of the respective dimension. See
>>>> below for examples.
>>>>
>>>> This is a bit annoying for practical work. Would it be possible to make
>>>> sure that the labeling remains intact?
>>> Shouldn't be too difficult; I'll take a look.
>> Thank you, Allin!
> That's now done in git. For selifc and selifr, if the input matrix has
> names in the dimension subject to selection we copy across the
> appropriate subset. And if it has names in the other dimension we copy
> them all across to the result.
>
> While I was at it I revised the name-handling behaviour of column and
> row concatenation. In the case of C = A ~ B, if A has rownames we copy
> them to C, and if both A and B have column names we use them to name
> the columns of C. And similarly, mutatis mutandis, for C = A | B.
Thank you, Allin. This works fine! However, I just found that the following
won't work -- is this intended?
<hansl>
matrix A = mnormal(3,2)
strings cname = defarray("A", "B")
strings rname = defarray("R1", "R2", "R3")
cnameset(A, cname)
rnameset(A, rname)
eval A[-1,]
eval A[,-2]
</hansl>
If you'll pardon me, Artur: No, of course it's not "intended" in the
sense that Jack and I said to ourselves, "Let's not allow that".
It's not the case that everything works except for what we disallow.
Rather, nothing works unless we explicitly code for it to work, and
up to now we haven't thought to code for preservation of row or
column names in the case where rows or columns are removed. However,
it does seem reasonable that it might work, so we can think of
enabling it, when we can get around to it.
Allin