dear R users
 I have been trying a lot to get this task accomplished but need your help.
 
 input:
 x <- c(3,3,4,4,4,4,5,7,7,0,1,1,2,2,2)
 
 desired output
 3 1 2 
 4 3 6
 7 8 9
 ...
 which means, 
 3 is repeated at index 1:2
 4 is repeated at index 3:6
 ...
 my effort has not been that good.
 a <- !c(NA,diff(x)); 
 b <- which(a==1);
 a[b-1]=1;
 cbind(x,a);
 
 or
 sp <- (seq(diff(x))[!!cumsum(!!diff(x))])[1];sp
 #first locations of duplicates
 l <- which(diff(x[sp:length(x)])==0); l
  m <- which(diff(l)==1);m
 flod <- l[m]+1; print(flod);
 
 
 thank you
			
---------------------------------

	[[alternative HTML version deleted]]


