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.
15 lines
320 B
15 lines
320 B
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)
|
|
)
|
|
|
|
}
|
|
|