Learn R Programming

TraMineR (version 2.2-10)

seqelength: Lengths of event sequences

Description

The length of an event sequence is its time span, i.e., the total time of observation. This information is useful to perform for instance a survival analysis. The function seqelength retrieves the lengths of the provided sequences, while seqelength <- sets the length of the sequences.

Usage

seqelength(eseq, s)
seqelength(eseq, s) <- value

Value

A numeric vector with the lengths of the sequences.

Arguments

eseq

An event sequence object (seqelist).

value

A list of sequence lengths.

s

Deprecated. Use eseq instead.

Author

Matthias Studer (with Gilbert Ritschard for the help page)

Examples

Run this code
data(actcal.tse)
actcal.eseq <- seqecreate(actcal.tse)
## Since end.event is not specified, contains no sequence lengths
## We set them manually as 12 for all sequences
sl <- numeric()
sl[1:2000] <- 12
seqelength(actcal.eseq) <- sl
actcal.eseq[1:10]
## Retrieve lengths
slen <- seqelength(actcal.eseq)
summary(slen)

Run the code above in your browser using DataLab