[R] (no subject)
Marine.Andersson at ki.se
Fri Jan 28 15:37:07 CET 2011
I have a data set with each column containing data like this:
>From this I would like to extract the sequence containing at least three rows of 3 in a row (exlcuding NAs). I would also like to have the row numbers showing the place of the last number unequal to 3 befor the first 3 in the sequence and the place of the next number after the last 3 in the sequence.
So in this example I would get 11 to 18 as the sequence rows and row 7 to 19 as the rows showing the numbers before and after that are unequal to three.
The rle does not work since it is not possible to exlude the NAs.
I hope you understand the question. All help is highly appreciated.
More information about the R-help