You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
320 B
16 lines
320 B
6 years ago
|
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)
|
||
|
)
|
||
|
|
||
|
}
|