[R] How to find frequent sequences.
savicky at cs.cas.cz
Sat Jul 14 09:57:58 CEST 2012
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
> 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))" ?
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.
More information about the R-help