I guess what I suggested violates operator precedence rule.  It would only
work if somehow the subset operators can recognize the "-" first and treat
whatever follows in a different way; i.e., to recognize that -numeric(0) is
NOT the same as numeric(0).  Oh well...
 
Andy

-----Original Message-----
From: Patrick Burns [mailto:pburns@pburns.seanet.com] 
Sent: Friday, November 14, 2003 12:06 PM
To: Liaw, Andy
Cc: 'Thomas Lumley'; David Orme; r-help@stat.math.ethz.ch
Subject: Re: [R] Vector indices and minus sign




Liaw, Andy wrote:


From: Thomas Lumley [mailto:tlumley@u.washington.edu
<mailto:tlumley@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.)

I agree that  x[-c("Andy", "Pat")] would come in handy at times, but
x[-numeric(0)] still can not work because the numbers that aren't there
might be negative and the minus sign is to put them positive.

Pat




[A bit OT: I remembered that among the list of bugs fixed in Splus 3.2 for

Windows is -0 == 0 is F...]



Andy



______________________________________________

R-help@stat.math.ethz.ch <mailto:R-help@stat.math.ethz.ch>  mailing list

https://www.stat.math.ethz.ch/mailman/listinfo/r-help
<https://www.stat.math.ethz.ch/mailman/listinfo/r-help> 





  



	[[alternative HTML version deleted]]


