Message-ID: <503D329C.3070801@stats.uwo.ca>
Date: 2012-08-28T21:05:32Z
From: Duncan Murdoch
Subject: Search for locations of subsequences?
Is there a function to efficiently search for a subsequence within a vector?
For example, with
x <- 1:100
I'd like to search for the sequence c(49,50,51), and be told that it
occurs exactly once, starting at location 49. (The items in the vectors
might be numeric or character, and there might be repetitions within the
search pattern or within the vector I'm searching.)
Duncan Murdoch