get_sequence | R Documentation |
Given a vector x
and a pattern
, the function returns the
start and end indices of the sequences with at least minsize
repetitions of the pattern
.
get_sequence(x, pattern, minsize = 2L)
x |
a vector |
pattern |
the pattern to look for |
minsize |
the minimum length of the repeating pattern. Must be higher than 2 for single pattern. |
Returns a matrix with the range of the sequence. Each row representes a sequence.
Jakob Gepp, Robin Kraft
get_sequence(x = c(0,1,1,0,0,0,0,3,0,0,1,0,423,0,0,0,0,0,1,0),
pattern = 0,
minsize = 4)
# min max
# [1,] 4 7
# [2,] 14 18
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.