TSE_to_STS {TraMineRextras} | R Documentation |
Converting TSE data into STS (state sequences) format.
Description
Conversion from TSE (time stamped event sequences) vertical format into STS (state sequences) data format.
Usage
TSE_to_STS(seqdata, id = 1, timestamp = 2, event = 3, stm = NULL, tmin = 1,
tmax = NULL, firstState = "None")
Arguments
seqdata |
a data frame or matrix with event sequence data in TSE format. |
id |
Name or index of the column containing the id's of the sequences. |
timestamp |
Name or index of the column containing the timestamps of the events. |
event |
Name or index of the column containing the events. |
stm |
An event to state transition matrix (See |
tmin |
Integer. Starting time of the state sequence. |
tmax |
Integer. Ending time of the state sequence. |
firstState |
Character. The name of the state before any events has occurred. |
Details
Convert TSE (time stamped event sequences) data into STS (state sequences) format. By default, the states are defined has the combination of events that already occurred.
Different schemes may be specified using function seqe2stm
and the stm
argument.
Value
A data.frame
with the sequences in STS format.
Note
This function is a pre-release and further testing is still needed, please report any problems.
Author(s)
Matthias Studer
References
Ritschard, G., Gabadinho, A., Studer, M. & Müller, N.S. (2009), "Converting between various sequence representations", In Ras, Z. & Dardzinska, A. (eds) Advances in Data Management. Series: Studies in Computational Intelligence. Volume 223, pp. 155-175. Berlin: Springer.
See Also
Examples
data(actcal.tse)
events <- c("PartTime", "NoActivity", "FullTime", "LowPartTime")
## Dropping all previous events.
stm <- seqe2stm(events, dropList=list(PartTime=events[-1],
NoActivity=events[-2], FullTime=events[-3], LowPartTime=events[-4]))
mysts <- TSE_to_STS(actcal.tse[1:100,], id=1, timestamp=2, event=3,
stm=stm, tmin=1, tmax=12, firstState="None")