Re: [R] Basic question on function "identical"

2003-12-15 Thread Paul Johnson
I hope I am not telling you things you already know. If so, I apologize in advance. There are several C-library addons available to try to deal with the problem that comparisons of floating point numbers can be unpredictable. I think your example with the greater than sign would not be a sour

Re: [R] Basic question on function "identical"

2003-12-15 Thread Thomas Lumley
On Mon, 15 Dec 2003 [EMAIL PROTECTED] wrote: > On 15-Dec-03 Thomas Lumley wrote: > > > > One reason that which.max() exists is that we cannot guarantee > > which(x==max(x)) to work. It is possible, though rather unlikely, for > > there to be no x such that x==max(x). One reason is the unpredictab

Re: [R] Basic question on function "identical"

2003-12-15 Thread Ted Harding
On 15-Dec-03 Thomas Lumley wrote: > > One reason that which.max() exists is that we cannot guarantee > which(x==max(x)) to work. It is possible, though rather unlikely, for > there to be no x such that x==max(x). One reason is the unpredictable > use of 10-byte wide floating point registers on In

Re: [R] Basic question on function "identical"

2003-12-15 Thread Thomas Lumley
On Sat, 13 Dec 2003 [EMAIL PROTECTED] wrote: > On 13-Dec-03 Martin Maechler wrote: > > In general, use > > > > == for testing equality of integer numbers (of type "integer" > >or not) > > I hope this is not a suggestion to avoid usage like > > which(x == max(x)) > > when x is

Re: [R] Basic question on function

2003-12-13 Thread Gabor Grothendieck
In that particular case there is also which.max(x) --- Date: Sat, 13 Dec 2003 13:31:42 - (GMT) From: <[EMAIL PROTECTED]> To: Martin Maechler <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Subject: Re: [R] Basic question on function "identical" On 13-

Re: [R] Basic question on function "identical"

2003-12-13 Thread Ted Harding
On 13-Dec-03 Martin Maechler wrote: > In general, use > > == for testing equality of integer numbers (of type "integer" >or not) I hope this is not a suggestion to avoid usage like which(x == max(x)) when x is a vector of reals? (i.e. should be OK when you know that the th

Re: [R] Basic question on function "identical"

2003-12-13 Thread Martin Maechler
> "TL" == Thomas Lumley <[EMAIL PROTECTED]> > on Fri, 12 Dec 2003 14:54:51 -0800 (PST) writes: TL> On Fri, 12 Dec 2003, John Welsh wrote: >> >> >> > for(i in c(1:5)) + { + print(identical(i,1)) + } >> >> [1] FALSE [1] FALSE [1] FALSE [1] FALSE [1] FALSE >

RE: [R] Basic question on function

2003-12-12 Thread Gabor Grothendieck
One is an integer and the other is not. Try for (i in 1:5) print( identical( i, as.integer(1) ) ) --- Date: Fri, 12 Dec 2003 14:47:07 -0800 From: John Welsh <[EMAIL PROTECTED]> To: '[EMAIL PROTECTED]' <[EMAIL PROTECTED]> Subject: [R] Basic question on function "id

Re: [R] Basic question on function "identical"

2003-12-12 Thread Thomas Lumley
On Fri, 12 Dec 2003, John Welsh wrote: > > > > for(i in c(1:5)) > + { > + print(identical(i,1)) > + } > > [1] FALSE > [1] FALSE > [1] FALSE > [1] FALSE > [1] FALSE > > Why don't I get: > > [1] TRUE > [1] FALSE > [1] FALSE > [1] FALSE > [1] FALSE > Because the first element of 1:5 is an integer an

[R] Basic question on function "identical"

2003-12-12 Thread John Welsh
> for(i in c(1:5)) + { + print(identical(i,1)) + } [1] FALSE [1] FALSE [1] FALSE [1] FALSE [1] FALSE Why don't I get: [1] TRUE [1] FALSE [1] FALSE [1] FALSE [1] FALSE John Welsh Associate Professor Sidney Kimmel Cancer Center 10835 Altman Row San Diego, CA 92121 (858) 450-5990 ex.282 [EMAIL