start_end | R Documentation |
Get the locations of start/end places for the ones in a binary vector.
start_end(x)
x |
A vector of 1 and 0 or |
Returns a two column data.frame
of start and end locations for ones.
Roland (https://stackoverflow.com/users/1412059/roland) and Tyler Rinker <tyler.rinker@gmail.com>.
https://stackoverflow.com/a/29184841/1000343
set.seed(10); (x <- sample(0:1, 50, TRUE, c(.35, .65)))
start_end(x)
(y <- sample(c(TRUE, FALSE), 50, TRUE, c(.35, .65)))
start_end(y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.