On Fri, Jul 13, 2012 at 02:38:57PM -0500, Vineet Shukla wrote: > Hi Petr, > Yes, that's really very helpful. > > > Petr : Using this interpretation, AB occurs at lines 1,3,4 and not 1,3,5. > Is this correct? > Vineet : Yes , thats right sorry for the typo. > > > > Petr: If some sequence contains several ocurrences of a pattern, for > example, > the sequence > A, B, A, B > contains AB twice, then it is counted only once? > > Vineet : what needs to be done if I would like to count it as many times as > it occurred ? > remove dont call unique function from "unique(embed(rev(x), lpattern))" ?
Hi. Yes. Without unique() the matrix embed(rev(x), lpattern) contains all occurences in one sequence and the final result will be the sum of the numbers of occurences in all sequences. Petr. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.