seqpm {TraMineR}R Documentation

Find patterns in sequences

Description

Search for a pattern (subsequence) into sequences.

Usage

 seqpm(seqdata, pattern)

Arguments

seqdata a sequence object as defined by the seqdef function.
pattern a character string representing the pattern (subsequence) to search for, without sperator between the states.

Details

This function search a pattern (a character string) into a set of sequences and returns a list containing the results. The elements of the list are 'Nbmatch', containing the number of occurences of pattern and 'MatchesIndex', containing the indexes (row numbers) of the sequences that match the pattern (see exemples below).

Value

a list with two elements (see details).

Examples

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")

[Package TraMineR version 1.1 Index]