I\'d like to have a function which returns the initial indicies of matching subsequences of a vector. For example:
y <- c(\"a\",\"a\",\"a\",\"b\",\"c\")
Try rollapply in zoo:
rollapply
library(zoo) which(rollapply(y, 2, identical, c("a", "a"))) ## [1] 1 2 which(rollapply(y, 2, identical, c("a", "b"))) ## [1] 3