Many thanks for the fast reply of Leeds
Here's all the anwer I got:

Here's the winner: Patrick Burns
with:
* any(duplicated(rle(x)$values))
followed by:

Peter McMahan:
non.contig.dupes <- function(x){
is.dup <- x %in% x[duplicated(x)]
is.con <- c(x[-length(x)]==x[-1],F) | c(F,x[-length(x)]==x[-1])
is.dup & !is.con}


then mine (size was 6 just for test):
function (z) {zz<-t(z);risp<-matrix(FALSE,1,6);
for (i in c(1,2,3,4,5,6)){
if (
(zz[i]%in%zz[-c(max(0,i-1),i,min(i+1,6))]))
&&
(
( (i>1) &&(i<6)&& ((zz[i]!=zz[i-1])|| (zz[i]!=zz[i+1]) ))
||
( (i==1) && (zz[i]!=zz[i+1]))
||
( (i==6) && (zz[i]!=zz[i-1]))
)
)
{
risp[1,i]=TRUE;
}
}
risp;
}

aex-equo with Mark Leeds whose script does not work for all the situations:
temp<-diff(inmat)
temp<-temp[temp != 0]
duplicated(temp)


Many thanks to All of You 


------------------------------------------------------
Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom
http://infostrada.it


        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to