Hi all,
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?
Best,
Artur
<hansl>
clear
set verbose off
matrix M = mnormal(3,2)
cnameset(M, defarray("C1", "C2"))
rnameset(M, defarray("R1", "R2", "R3"))
print M
# sorting does not affect row names
eval msortby(M,1)
eval msortby(M,2)
# select rows
matrix row_select = {1;1;1}
eval selifr(M, row_select) # row names still fine + col names fine
matrix row_select = {1;1;0}
eval selifr(M, row_select) # row names lost + col names fine
matrix row_select = {1;0;1}
eval selifr(M, row_select) # row names lost + col names fine
# select columns
matrix col_select = {1;1}'
eval selifc(M, col_select) # col names still fine + row names fine
matrix col_select = {1;0}'
eval selifc(M, col_select) # col names lost + row names fine
matrix col_select = {0;1}'
eval selifc(M, col_select) # col names lost + row names fine
</hansl>