I have the following problem. I want to count the number of occurrences of values that are less than or equal to zero. An example in the following data: 3 cases 1 (0,0,0), 2 (-1, -2), 3 (0,0). Is there a built-in function in R for counting sequential events.
a <- c(2,4,5,3,2,4,7,0,0,0,4,3,2,-1,-2,3,2,0,0,4)
source
share