Skip to content
Back to formatted view

Raw Message

Message-ID: <20210823130455.elz4zqgcsj5oyduv@localhost>
Date: 2021-08-23T13:04:55Z
From: Frederick Eaton
Subject: clarify "by columns"

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