Skip to content
Prev 327407 / 398503 Next

How to split two levels several times?

Hi Rui
once more thank you for your help. But the code does so far not solve the problem because it still treats rows 17-22 (repeated appearance of electrode1) as one single level. However as can be seen by rows 1-3 (or rows 17-19 and rows 20-22) and the order of the length variable (row 1 = 5.7, row 2 = 6.3, row 3 = 6.2) electrode1 consists only of 3 rows. Maybe that was not made absolutely clear by me. As described in my mail before if by chance (or systematically) it happens to be that electrode1 appears right after each other in the table then the code should split it ?half way?.

So idx should not return
 [1] 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4

but instead 6 times number 4 at the end
 [1] 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4

Do you have any solution?