Re: [R] Counting consecutive events in R

2015-05-14 Thread Johannes Huesing
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

2015-05-14 Thread Sarah Goslee
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

[R] Counting consecutive events in R

2015-05-14 Thread Abhinaba Roy
Hi, I have the following dataframe structure(list(Type = c("QRS", "QRS", "QRS", "QRS", "QRS", "QRS", "QRS", "QRS", "QRS", "QRS", "QRS", "QRS", "RR", "RR", "RR", "PP", "PP", "PP", "PP", "PP", "PP", "PP", "PP", "PP", "QTc", "QTc", "QTc", "QTc", "QTc", "QTc", "QTc", "QTc", "QTc", "QTc", "QTc", "QTc"