On Mon, Jun 27, 2022 at 3:15 AM Sven Schreiber <svetosch(a)gmx.net> wrote:
Hi,
indirectly prompted by Artur's feature request (...) I stumbled over the
following behavior, which looks like a bug to me:
<hansl>
M = I(2)
M[2,1] = NA
print M
eval imaxr(M) # wrong: {1;1}
eval imaxc(M) # correct
</hansl>
That is, the NA doesn't lead to an NA result (which is fine even though
I'm not sure it's intended), but for imaxr the result picks the NA entry.
These functions were operating on the assumption that matrices cannot
contain NAs. For example, with imaxr() we were provisionally taking
the first element in a row as greatest, and changing that result only
if we found an element that compared greater than the first --
something that will never happen if the first element is NA.
I think the right thing to do is set the result to NA if an NA value
is encountered in the row or column in question. That's now in git.
Allin