mark_longest_run | R Documentation |
Find and mark the longest run of TRUEs in a boolean vector
mark_longest_run(vec)
vec |
(Logical) A vector. |
A new logical vector of the same length as vec
, where the longest run of
TRUEs is marked with TRUE and all other values are marked FALSE. If there are two
runs of TRUE with equal length in vec
, both will be reported in the results.
docendo discimus (https://stackoverflow.com/users/3521006)
https://stackoverflow.com/a/37447844
input <- c(TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)
mark_longest_run(input)
#> [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE TRUE TRUE TRUE FALSE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.