Re: [R] Counting consecutive events in R
I normally use rle() for these problems, see ?rle. for instance, k <- rbinom(999, 1, .5) series <- function(run) {
Re: [R] Counting consecutive events in R
Assuming I understand the problem correctly, you want to check for runs of at least length five where both Score and Test_desc assume particular values. You don't care where they are or what other data are associated, you just want to know if at least one such run exists in your data frame. Here's