Skip to content
Prev 168117 / 398502 Next

fonction PLATEAU???

Thibault Grava wrote:
I do not quite understand: If the data is constant, why do you want to 
extract it in that case?
Anyway, if data is really constant, then try the rle() function which 
tells you about the run lengths of constant parts (and you can get end 
values by cumsum of the rle output):

x <- c(1,1,1,2,2,2,2,2,1,1)
rle(x)
cumsum(rle(x)$lengths)  # end values


Uwe Ligges