From cberry at tajo.ucsd.edu  Wed Jul 19 18:19:47 2006
From: cberry at tajo.ucsd.edu (Charles C. Berry)
Date: Wed, 19 Jul 2006 09:19:47 -0700
Subject: [Rd] Patch to allow negative argument in head() and tail()
In-Reply-To: <17597.57223.151500.824538@stat.math.ethz.ch>
References: <200607171503.34713.vincent.goulet@act.ulaval.ca>
	<17596.40686.710925.321109@stat.math.ethz.ch>
	<200607181356.06360.vincent.goulet@act.ulaval.ca>
	<20060718214153.GA5151@alcyon.progiciels-bpi.ca>
	<17597.57223.151500.824538@stat.math.ethz.ch>
Message-ID: <Pine.LNX.4.64.0607190908350.19791@tajo.ucsd.edu>

On Wed, 19 Jul 2006, Martin Maechler wrote:

[most discussion of unix tail behavior deleted]

>
> I know that there is some "good" reason for the behavior of
> 'tail' in "Unix"
>  { tail -3 === tail -n  3   and
>    tail -3 === tail -n -3      }
>
> but of course, we can't be compatible here, because in S
> (and most reasonable languages :-)
> "3 == +3"  and  "3 != -3" !
>


Ahhh. But in R

 	quote( foo( +n ) ) != quote( foo( n ) )

so if one was determined to emulate GNU Coreutils tail's behavior it 
***could*** be done by using match.call to recover the explicit '+' or 
'-'.

But I shudder to think of the confusion that this approach might cause 
when n is an expression whose value is negative.


Chuck

Charles C. Berry                        (858) 534-2098
                                          Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	         UC San Diego
http://biostat.ucsd.edu/~cberry/         La Jolla, San Diego 92093-0717



[Rd] Patch to allow negative argument in head() and tail()
Charles C. Berry