Skip to content
Prev 57640 / 63424 Next

head.matrix can return 1000s of columns -- limit to n or add new argument?

Hi Martin,


On Wed, Oct 30, 2019 at 4:30 AM Martin Maechler <maechler at stat.math.ethz.ch>
wrote:
You're correct, of course. Apologies for that.
I hope you didn't construe my describing surprise (which was honest)  as a
criticism. It just quite literally not what I thought head(array(100, c(25,
2, 2))) would have done based on what head.matrix does is all.
That is pretty odd. IMHO It would be quite nice from a design perspective
to fix that, but I do wonder, as I infer you do as well, how much code it
would break.

Changing this would cause problems in any case where a generic has an array
method but no matrix method, as well as any code that explicitly checks for
inherits from "array" assuming matrices won't return true, correct? My
intuition is that the former would be pretty rare, though it might be a fun
little problem to figure it out.  The latter is ...probably also fairly
rare? My intuition on that one is less strong though.
Absolutely, will do. I'm gratified we're going after the more general
approach. Thanks for working with us on this.

Best,
~G