Description Usage Arguments Details Value Examples
View source: R/streak_length.R
Finds streaks in a vector containing consecutively-repeated values, and in each streak indicates the number of values into the streak so far
1 | streak_length(x, streak_val = 1, fill_val = 0)
|
x |
vector of numbers |
streak_val |
value in |
fill_val |
value in output to indicate indices that are part of non-streak |
Functions like rle
, but within each run (streak) indicates the current position of each value where the first value in the streak is 1 and the last value in the streak is the length of the streak
Returns a vector the same length as x
that contains streak lengths and 0's
1 | streak_length(c(1,1,1,0,0,1,0,1,0,0,1,1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.