R/util.R

seq_in <- function(source_vector, pattern_vector) {

  which(
    Reduce(
      '+',
      lapply(
        seq_along(y <- lapply(pattern_vector, '==', source_vector)),
        function(x) {
          y[[x]][x:(length(source_vector) - length(pattern_vector) + x)]
        }
      )
    ) == length(pattern_vector)
  )

}

Try the wand package in your browser

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

wand documentation built on July 9, 2019, 1:02 a.m.