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

Charles C. Berry cberry at tajo.ucsd.edu
Wed Jul 19 18:19:47 CEST 2006


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



More information about the R-devel mailing list