https://github.com/cran/wand
Raw File
Tip revision: 4cddbdcd8cec49b2059110b80d7da6ca7d3c9e86 authored by Bob Rudis on 08 July 2019, 17:50:10 UTC
version 0.5.0
Tip revision: 4cddbdc
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)
  )

}
back to top