| seqecreate {TraMineR} | R Documentation |
Create event sequence objects from the given input.
seqecreate(data = NULL, id = NULL, timestamp = NULL, event = NULL,
endEvent = NULL, tevent = "transition")
data |
A state sequence or a data.frame |
id |
The sequence id as an integer. |
timestamp |
Dates of events as a double. |
event |
The event that appeared at the specified date. |
endEvent |
If specified this event will be considered as a flag for the end of observation time (total length of event sequences). |
tevent |
If data is a state sequence either a transition matrix or a method to generate it (see seqetm |
There are several way to create events sequences. The first one is to use the TSE format (see seqformat). It consist in three list of the same size idpers, timestamp and event. Several events can appear at the same time.
You can set these parameters using the data argument with a data.frame. Then the function will look to an "id", "timestamp" and "event" column in the data frame. You can also set this parameters separately using the argument with the same names.
The other way is to use a state sequences. Each transition will be considered as an event. You can specify the event appearing in each transition using tevent argument in the same way as in seqformat. You can build one automatically using seqetm. If tevent is set to null, then each transition will be considered as a specific event.
You can pass a sequence using the data argument.
The result can then be used in other methods, such as seqefsub or seqeapplysub.
seqformat for TSE format information
seqefsub for searching frequent subsequences.
seqecmpgroup to search for discriminant subsequences.
seqeapplysub for counting subsequences and more.
seqelength about length (observation time) of event sequences.
##Starting with states sequences
##Loading data
data(biofam)
## Creating state sequences
biofam.seq <- seqdef(biofam,10:25,informat='STS')
## Creating event sequences from biofam
biofam.seqe <- seqecreate(biofam.seq)
## Loading data
data(actcal.tse)
## Creating sequences
actcal.seqe <- seqecreate(id=actcal.tse$id, timestamp=actcal.tse$time,
event=actcal.tse$event)
##printing sequences
actcal.seqe[1:10]
## Using the data argument
actcal.seqe <- seqecreate(data=actcal.tse)