[Rd] clarify "by columns"

Frederick Eaton |reder|k @end|ng |rom o|b@net
Mon Aug 23 15:04:55 CEST 2021


Dear R Devel,

I realized that I've been reading something without really thinking
about it. In "?matrix" we have:

        byrow: logical. If 'FALSE' (the default) the matrix is filled by
               columns, otherwise the matrix is filled by rows.

I don't understand on the first reading what "by columns" means. An
experiment ("matrix(1:6,ncol=2,nrow=3)") shows that it means "one
column at a time" rather than "rotating through the columns" as I had
first imagined. However, the purpose of my looking up this
documentation was to remind myself of the order of matrix elements in
R; since I had to do the experiment anyway, I think the documentation
added a useless delay. Perhaps this could be fixed if we define the
meaning of "by columns" in the documentation?

Apparently this is the same as "column-major order", but I am usually
just as unfamiliar with the meaning of this other phrase. I would like
the documentation to define both phrases, for example:

        byrow: logical. If 'FALSE' (the default) the matrix is filled
               by columns, i.e. in "column-major order", meaning that
               matrix elements in the same column are assigned
               consecutive data elements. Otherwise the matrix is
               filled by rows.

Is that too wordy?

Thank you,

Frederick



More information about the R-devel mailing list