1
seq_in <- function(source_vector, pattern_vector) {
2

3 1
  which(
4 1
    Reduce(
5
      '+',
6 1
      lapply(
7 1
        seq_along(y <- lapply(pattern_vector, '==', source_vector)),
8 1
        function(x) {
9 1
          y[[x]][x:(length(source_vector) - length(pattern_vector) + x)]
10
        }
11
      )
12 1
    ) == length(pattern_vector)
13
  )
14

15
}

Read our documentation on viewing source code .

Loading