Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-22 Thread Petr PIKAL
There are several replies to the question below, but I think there must > > exist a better way of doing so. > > I just want to check whether all the elements of a vector are same. My > > vector has one million elements and it is highly likely that there are > > distinct

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-19 Thread utkarshsinghal
000)) > > > > I want the answer as FALSE, which is clear from the first two > > observations itself and we don't need to check for the rest. > > > > Does anybody know the most efficient way of doing this? > > > > Regards > &

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-19 Thread jim holtman
tor has one million elements and it is highly likely that there are > > distinct elements in the first few itself. For example: > > > > > x = c(1,2,rep(1,10)) > > > > I want the answer as FALSE, which is clear from the first two > > observations itself and we

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-19 Thread Petr PIKAL
gt; Does anybody know the most efficient way of doing this? > > Regards > Utkarsh > > > > From: Francisco J. Zagmutt <mailto:gerifalte28_at_hotmail.com > ?Subject=Re:%20%5BR%5D%20Testing%20if%20all%20elements%20are%20equal%20in%20a% > 20vector/matrix>> > >

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-17 Thread utkarshsinghal
t;> I just want to check whether all the elements of a vector are >>>>> same. My >>>>> vector has one million elements and it is highly likely that there >>>>> are >>>>> distinct elements in the first few itself. For example: >>>>

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-16 Thread Prof Brian Ripley
>-Original Message- / />From: r-help-boun...@stat.math.ethz.ch / />[mailto:r-help-boun...@stat.math.ethz.ch] On Behalf Of Vincent Goulet / />Sent: Monday, August 29, 2005 3:35 PM / />To: r-h...@stat.math.ethz.ch / />Subject: [R] Testing if all elements are equal in a vector/matr

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-16 Thread Prof Brian Ripley
7; is an abbreviation of 'identical(TRUE,x)' so actually Vincent's solutions is "cleaner" than using identical :) Cheers Francisco />From: "Doran, Harold" / />To: , / />Subject: Re: [R] Testing if all elements are equal in a vector/matrix / />Date:

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-16 Thread utkarshsinghal
7;t need to check for the rest. >>> >>> Does anybody know the most efficient way of doing this? >>> >>> Regards >>> Utkarsh >>> >>> >>> >>> From: Francisco J. Zagmutt >> <http://gerifalte28

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-16 Thread baptiste auguie
[correcting a stupid error in my previous post] testTwoStages <- function(x, y, head.stop = 100){ if(!isTRUE(all(head(x, head.stop) == head(y, head.stop { print(paste("quick test returned FALSE")) return(FALSE) } else { full.test = isTRUE(all(tail(x, length(x) - head.stop) == tail(

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-16 Thread Petr PIKAL
ue 30 Aug 2005 - 06:05:20 EST > > > > > > Hi Doran > > > > The documentation for isTRUE reads 'isTRUE(x)' is an abbreviation of > > 'identical(TRUE,x)' so actually Vincent's solutions is "cleaner" than > > using

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-16 Thread baptiste auguie
cumentation for isTRUE reads 'isTRUE(x)' is an abbreviation of 'identical(TRUE,x)' so actually Vincent's solutions is "cleaner" than using identical :) Cheers Francisco />From: "Doran, Harold" mailto:hdo...@air.org>> / /

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-16 Thread jim holtman
%20in%20a%20vector/matrix>> >> >> Date: Tue 30 Aug 2005 - 06:05:20 EST >> >> >> Hi Doran >> >> The documentation for isTRUE reads 'isTRUE(x)' is an abbreviation of >> 'identical(TRUE,x)' so actually Vincent's solutions

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-16 Thread utkarshsinghal
lly Vincent's solutions is "cleaner" than > using identical :) > > Cheers > > Francisco > > />From: "Doran, Harold" mailto:hdo...@air.org>> / > />To: <mailto:vincent.gou...@act.ulaval.ca>>,

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-16 Thread jim holtman
ate: Tue 30 Aug 2005 - 06:05:20 EST > > > Hi Doran > > The documentation for isTRUE reads 'isTRUE(x)' is an abbreviation of > 'identical(TRUE,x)' so actually Vincent's solutions is "cleaner" than > using identical :) > > Cheers > &

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-16 Thread utkarshsinghal
cent's solutions is "cleaner" than using identical :) Cheers Francisco />From: "Doran, Harold" / />To: , / />Subject: Re: [R] Testing if all elements are equal in a vector/matrix / />Date: Mon, 29 Aug 2005 15:49:20 -0400 / /> / >See ?id