[R] Vector indices and minus sign

Liaw, Andy andy_liaw at merck.com
Fri Nov 14 17:38:03 CET 2003


> From: Thomas Lumley [mailto:tlumley at u.washington.edu] 
> 
> On Fri, 14 Nov 2003, David Orme wrote:
> 
> > Hi,
> >
> > I got caught out by this behaviour in 1.8.0 and I wondered why this
> > happens:
> >
> 
> Some anomaly of this sort is unavoidable because R allows 
> positive or negative numeric indices. It can't distinguish 
> between a vector of no positive numbers and a vector of no 
> negative numbers.
> 
> 	-thomas

I guess this can only work if "-" is treated specially in the subset
operators, so that, e.g., x[-"Andy"] would also work.  (This would be nice,
IMHO.)

[A bit OT: I remembered that among the list of bugs fixed in Splus 3.2 for
Windows is -0 == 0 is F...]

Andy




More information about the R-help mailing list