trle_cond {nseq} | R Documentation |
Count the number of events in a sequence
Description
This function will count the occurrence of sequential events that meets some conditions.
Usage
trle_cond(x, a_op = "gte", a, b_op = "gte", b, isolated = FALSE)
Arguments
x |
numeric vector. |
a_op , b_op |
character. Operator, |
a |
integer. Length of period threshold. |
b |
integer. Value threshold. |
isolated |
logical. Consider only isolated events, i.e. surrounded by zeros. On this case, |
Details
Example: In a vector, how many sequences have at least 3 consecutive observations (a_op = "gte", a = 3
) with values equal or greater than 5 (b_op = "gte", b = 5
)?
Value
a numeric value.
Examples
# How many sequences have at least 3 consecutive observations with value equal or greater than 5?
trle_cond(x = c(8,15,20,0,0,0,0,5,9,12), a_op = "gte", a = 3, b_op = "gte", b = 5)
[Package nseq version 0.1.1 Index]