Re: [Rd] Patch to allow negative argument in head() and tail()

From: François Pinard <>
Date: Tue 18 Jul 2006 - 21:41:53 GMT

[Vincent Goulet]

>For me, this usage of head() and tail() is, at first, completely
>unintuitive since I more used to, say, "start from the beginning (head)
>of the vector and drop the first n elements" than "return the end of
>the vector except the first n elements". But I must agree your
>convention does make sense!

Vincent -- bonjour!, Martin -- hi! and all others -- hello! :-)

The usual head and tail Unix utilities, as found within GNU Coreutils, have conventions for negative numbers. See:

  $ seq 10 | head -n-3
  $ seq 10 | tail -n-3

Of course, these do not rule what R should do in any way. Yet, it is sometimes convenient and even elegant when tools having similar names have similar behaviour. Despite application domains are different, it's worth pondering such similarities, when these are easily possible.

François Pinard

______________________________________________ mailing list
Received on Wed Jul 19 07:43:10 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 19 Jul 2006 - 10:28:34 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.