Skip to contents

Identifies the length of the longest run of TRUEs in Boolean vector x. used to be maxCMS

Usage

get_longest_run(x)

Arguments

x

Boolean vector

Value

an integer value of the length of the longest run of TRUE values

Examples

x <- rbinom(100, size = 1, prob = 1 / 3)
get_runs(x == 1) # expected value for longest match is 3
#> 
#>  1  2 
#> 12  8 
get_longest_run(x == 1)
#> [1] 2