[Rd] class(<matrix>) |--> c("matrix", "arrary") [was "head.matrix ..."]

Abby Spurdle @purd|e@@ @end|ng |rom gm@||@com
Fri Nov 15 22:19:24 CET 2019

> > And indeed I think you are right on spot and this would mean
> > that indeed the implicit class
> > "matrix" should rather become c("matrix", "array").
> I've made up my mind (and not been contradicted by my fellow R
> corers) to try go there for  R 4.0.0   next April.

I'm not enthusiastic about matrices extending arrays.
If a matrix is an array, then shouldn't all vectors in R, be arrays too?

> #mockup
> class (1)
[1] "numeric" "array"

Which is a bad idea.
It contradicts the central principle that R uses "Vectors" rather than "Arrays".
And I feel that matrices are and should be, a special case of vectors.
(With their inheritance from vectors taking precedence over anything else).

If the motivation is to solve the problem of 2D arrays, automatically
being mapped to matrices:

> class (array (1, c (2, 2) ) )
[1] "matrix"

Then wouldn't it be better, to treat 2D arrays, as a special case, and
leave matrices as they are?

> #mockup
> class (array (1, c (2, 2) ) )
[1] "array2d" "matrix" "array"

Then 2D arrays would have access to both matrix and array methods...

Note, I don't want to enter into (another) discussion on the
differences between implicit class and classes defined via a class
That's another discussion, which has little to do with my points above.

More information about the R-devel mailing list