[Rd] bugs in head() and tail()

Abs Spurdle @purd|e@@ @end|ng |rom gm@||@com
Wed Mar 27 02:51:00 CET 2019


> so instead of hitting utils:::head.function, it hits
utils:::head.default, which uses [ on the argument, causing the error.

I've thought about this some more.
And I still think that this is a bug.

If a generic has a default method, then that default method should be
guaranteed to work.
Or at least, provide a useful error message, that makes it obvious to the
user, what he or she has done wrong.

In the case of head.default(), it assumes that the object is a vector, or
something similar.
This assumption is untrue.

>> Error in x[seq_len(n)] : object of type 'closure' is not subsettable

Resulting in the error above, which fails to recognize that the input was
unsuitable.

	[[alternative HTML version deleted]]



More information about the R-devel mailing list