From pinard at iro.umontreal.ca  Tue Jul 18 23:41:53 2006
From: pinard at iro.umontreal.ca (=?iso-8859-1?Q?Fran=E7ois?= Pinard)
Date: Tue, 18 Jul 2006 17:41:53 -0400
Subject: [Rd] Patch to allow negative argument in head() and tail()
In-Reply-To: <200607181356.06360.vincent.goulet@act.ulaval.ca>
References: <200607171503.34713.vincent.goulet@act.ulaval.ca>
	<17596.40686.710925.321109@stat.math.ethz.ch>
	<200607181356.06360.vincent.goulet@act.ulaval.ca>
Message-ID: <20060718214153.GA5151@alcyon.progiciels-bpi.ca>

[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
  1
  2
  3
  4
  5
  6
  7
  $ seq 10 | tail -n-3
  8
  9
  10
  $

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   http://pinard.progiciels-bpi.ca



[Rd] Patch to allow negative argument in head() and tail()
=?iso-8859-1?Q?Fran=E7ois?= Pinard