TSE_to_STS: Converting TSE data into STS (state sequences) format.

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/TSE_TO_STS.R

Description

Conversion from TSE (time stamped event sequences) vertical format into STS (state sequences) data format.

Usage

1
2
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 seqe2stm).

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

See Also seqe2stm, seqformat.

Examples

1
2
3
4
5
6
7
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")

Example output

Loading required package: TraMineR

TraMineR stable version 2.0-7 (Built: "Sat,)
Website: http://traminer.unige.ch
Please type 'citation("TraMineR")' for citation information.

TraMineRextras stable version 0.4.1 (Built: 2017-09-21)
Functions provided by this package are still in test
    and subject to changes in future releases.

TraMineRextras documentation built on Feb. 1, 2018, 5:03 p.m.