View source: R/S03_Utilities.R
runs_in_sequence | R Documentation |
Given a sequence of values of which a subset are dubbed 'hits', determine the number of runs of hits and the start and end of each run of hits.
runs_in_sequence(x, codes_for_hit = 1)
x |
A vector of values. |
codes_for_run |
A vector of the values
in |
A list with a) the total number of runs, and b) a matrix with a column for the start position of each run and a column for the end position of each run.
# Generate a sequence of zeros and ones
x <- rbinom( 10, 1, .5 )
print(x)
# Determine runs of ones
runs_in_sequence( x )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.