Learn R Programming

TraMineR (version 1.1)

seqeapplysub: Applying Subsequences to Event Sequences

Description

Apply every subsequences subseq to each event sequences and compute the result of the given method.

Usage

seqeapplysub(subseq, method = "count", constraint = NULL)

Arguments

subseq
a list of subsequences
method
type of the result expected, should be one of "count", "presence" or "age"
constraint
Other time constraint overriding those used to compute subseq. See seqeconstraint

Value

  • The return value is a matrix where every row correspond to a sequence (row names are set accordingly) and each column correspond to a subsequence (col names are set accordingly). The matrix store the results of the count method.

Details

They are three methods implemented: 'count' counts the number of occurrence of a given subsequences in an event sequence; 'presence' returns one if the subsequence is present, 0 otherwise; 'age' returns the age of appearance of a subsequence in an event sequence. In case of multiple possiblities, the age of the first occurences is returned. When the subsequences is not in the sequence, -1 is returned.

See Also

See Also as seqecreate for more information on how to use event sequence analysis module.

Examples

Run this code
## Loading data
data(actcal.tse)

## Creating sequences
actcal.seqe <- seqecreate(actcal.tse)

## Printing sequences
actcal.seqe[1:10]

## Looking for frequent subsequences
fsubseq <- seqefsub(actcal.seqe,pMinSupport=0.01)

## Counting the number of occurence of each subsequence
msubcount <- seqeapplysub(fsubseq,method="count")
## First lines...
msubcount[1:10,1:10]
## Presence-absence of each subsequence
msubpres <- seqeapplysub(fsubseq,method="presence")
## First lines...
msubpres[1:10,1:10]

## Age of first appearance of each subsequence
msubage <- seqeapplysub(fsubseq,method="age")

## First lines...
msubage[1:10,1:10]

Run the code above in your browser using DataLab