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

Abby Spurdle @purd|e@@ @end|ng |rom gm@||@com
Sat Jul 13 01:03:07 CEST 2019

> I assume there are lots of backwards-compatibility issues as well as valid
> use cases for this behavior, so I guess defaulting to M[1:6, 1:6] is out
> the question.


> Is there any scope for adding a new argument to head.matrix that would
> allow this flexibility?

I agree with what you're trying to achieve.
However, I'm not sure this is as simple as you're suggesting.

What if the user wants "head" in rows but "tail" in columns.
Or "head" in rows, and both "head" and "tail" in columns.
With head and tail alone, there's a combinatorial explosion.

Also, when using tail on an unnamed matrix, it may be desirable to name
rows and columns.

And all of this assumes standard matrix objects.
Add in a matrix subclasses and related objects, and things get more complex

As I suggested in a another thread, a few days ago, I'm planning to write
an R package for matrices and matrix-like objects (possibly extending the
Matrix package), with an initial emphasis on subsetting, printing and
So, I'm interested to hear more suggestions on this topic.

	[[alternative HTML version deleted]]

More information about the R-devel mailing list