R/rsi.R

Defines functions rsi

Documented in rsi

#' Run Start Indices
#' 
#' Find the starting indices of runs in a vector.
#' 
#' @param x a vector of data.
#' 
#' @return a vector of indices indicating starting points for runs
#' 
#' @export
#' 
#' @examples
#' rsi(c(0,0,0,1,2,2,3,3,3,3,3,4))
#' 
rsi <- function(x) c(1,which(diff(x)!=0)+1)

Try the Rmisc package in your browser

Any scripts or data that you put into this service are public.

Rmisc documentation built on May 2, 2022, 5:05 p.m.