Compute the number of sequences of values in a vector that meets conditions of length and magnitude.
InstallationYou can install the development version of nseq from GitHub with:
ExampleOn this vector, how many sequences of values present at least 3 consecutive observations with values equal or greater than 5?
library(nseq)
vec <- c(8,15,20,8,1,7,8,0,-2,5,9,12,0,-1,4,2,3,1)
trle_cond(vec, a_op = "gte", a = 3, b_op = "gte", b = 5)
#> [1] 2
And how many sequences of values have exactly 3 consecutive observations with values equal or greater than 5?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4