The goal of sequenceR is to identify sequences of 1’s in a vector of 1’s and 0’s. The problem stems from needing to find such sequences efficiently in a simulation environment.
seqeunceR utilises the efficient convolution processes from the base R
stats package
You can install the released version of sequenceR from github with:
install.packages("remotes")
remotes::install_github("JamiePlace/sequenceR")This is a basic example which shows you how to solve a common problem:
library(sequenceR)
sequence_data <- c(0,0,0,1,1,1,0,1,0,1,0,1,1,1)
window <- 3
find_sequences(sequence_data, window = window)
#> [1] 0 0 0 1 0 0 0 0 0 0 0 1 0 0The output is a vector with length equal to that of the given vector with 1’s in the location where a sequence matching the requirements begins