seqpm | R Documentation |
Search for a pattern (substring) into sequences.
seqpm(seqdata, pattern, sep="")
seqdata |
a sequence object as defined by the |
pattern |
a character string representing the pattern (substring) to search for. |
sep |
state separator used in the pattern definition. |
This function searches a pattern (a character string) into a set of sequences and returns the results as a list with two elements: 'Nbmatch
' the number of occurrences of the pattern and 'MatchesIndex
' the vector of indexes (row numbers) of the sequences that match the pattern (see examples below).
a list with two elements (see details).
Alexis Gabadinho
data(actcal)
actcal.seq <- seqdef(actcal,13:24)
## search for pattern "DAAD"
## (no work-full time work-full time work-no work)
## results are stored in the 'daad' object
daad <- seqpm(actcal.seq,"DAAD")
## Looking at the sequences
## containing the pattern
actcal.seq[daad$MIndex,]
## search for pattern "AD"
## (full time work-no work)
seqpm(actcal.seq,"AD")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.