seqformat {TraMineR}R Documentation

Translation between sequence formats.

Description

Translate a sequence data set from one format to another.

Usage

seqformat(data, var=NULL, id=NULL, from=NULL, to=NULL, 
          nrep=NULL, tevent=NULL, stsep="-", covar=NULL)

Arguments

data a data frame or matrix containing sequence data.
var the list of columns containing the sequences. Defaut to NULL, ie all the columns. Whether the sequences are in the compressed (character strings) or extended format is automatically detected by counting the number of columns.
id identification number for the sequences. When using SPELL formt as input, this identification number is mandatory, in order to identify all spells belonging to each individual in the data set.
from format of the original data. Avalaible formats are: STS, SPS, SPELL
to format of the output data. Avalaible formats are: STS, SPS, SPELL, SRS, TSE
nrep number of previous states replicated, for the 'SRS' format
tevent when converting to time-stamped-event (TSE) format, a matrix of size 'ns' * 'ns' where 'ns' is the number of distinct states appearing in the sequences must be given. In this matrix, the cell a,b contains all events associated with a transition from state a to state b.
stsep the character used as separator in the original data if input format is separated character strings. By default, "-".
covar the list of columns containing associated covariates to be included in the output data frame. If to='SRS' is choosed, the covariates are replicated accross each row. Default to NULL.

Details

the 'seqformat' function is used to convert data from one format to another. The input data is first converted into the STS format and then converted to the output format. Depending on input and output formats, some information can be lost due to the steps in the conversion process. The output is a matrix, NOT a sequence object to be passed to TraMineR functions for plotting and mining sequences (use the seqdef function therefore).

Value

a data frame

See Also

seqdef

Examples

data(actcal)
actcal.SPS <- seqformat(actcal,13:24,from="STS",to="SPS")

[Package TraMineR version 1.0 Index]